title: Changing margin for emacs text-mode
body: <p>The only way I found to change margins in emacs to my liking without things acting funny is this:</p>
  
  <pre><code>(add-hook 'window-configuration-change-hook
            (lambda ()
              (set-window-margins (car (get-buffer-window-list (current-buffer) nil t)) 24 24)))
  </code></pre>
  
  <p>I would like for this setting to be invoked only in text-mode and change back when I change to other modes. Somewhat naively I tried this:</p>
  
  <pre><code>(add-hook 'text-mode-hook
            (lambda ()
              (set-window-margins (car (get-buffer-window-list (current-buffer) nil t)) 24 24)))
  </code></pre>
  
  <p>But it's not working. What would be the right code to have the margins only change for buffers in text-mode?</p>