elisp - Changing margin for emacs text-mode -


the way found change margins in emacs liking without things acting funny this:

(add-hook 'window-configuration-change-hook           (lambda ()             (set-window-margins (car (get-buffer-window-list (current-buffer) nil t)) 24 24))) 

i setting invoked in text-mode , change when change other modes. naively tried this:

(add-hook 'text-mode-hook           (lambda ()             (set-window-margins (car (get-buffer-window-list (current-buffer) nil t)) 24 24))) 

but it's not working. right code have margins change buffers in text-mode?

even though can set margins using set-window-margins, lost change window in way. better solution set variables left-margin-width , right-margin-width. example:

(defun my-set-margins ()   "set margins in current buffer."   (setq left-margin-width 24)   (setq right-margin-width 24))  (add-hook 'text-mode-hook 'my-set-margins) 

Comments