My goal is that I want all my buffers to have the same basic margins; in org-mode, I have line numbers off for performance reasons, so I want to pad the margins. Here’s what it looks like now:
How can I make it that all my org buffers automatically have the marginal padding without having the line number mode? I didn’t see a different relevant hook on the org documentation, but I wouldn’t be surprised if I missed something obvious.
Thanks, that helps. I see that you’re using the (visual-fill-column-center-text t) which does push it from the margin, so that’s a help when my window is large enough to exceed visual-fill-column-width.
But if I’m working with emacs in a smaller window (which I regularly do), the text is “centered” and so pushed up against the left margin again.
Anyone else manage to adjust the margins? My (set-window-margins (selected-window) 3 3) works except that the org-mode-hook doesn’t load it. Anyone have a clue why that is the case?
Mmm, I think I do like this. Here’s an unpushed excerpt from my config:
Display-wise, somehow I don’t mind code buffers without any margin on the left, but it feels a bit off with text buffers once the padding provided by line numbers is stripped away.
(defvar +text-mode-left-margin-width 1
"The `left-margin-width' to be used in `text-mode' buffers.")
(defun +setup-text-mode-left-margin ()
(when (and (derived-mode-p 'text-mode)
(eq (current-buffer) ; Check current buffer is active.
(window-buffer (frame-selected-window))))
(setq left-margin-width (if display-line-numbers
0 +text-mode-left-margin-width))
(set-window-buffer (get-buffer-window (current-buffer))
(current-buffer))))
Now we just need to hook this up to all the events which could either indicate a change in the conditions, or a require the setup to be re-applied.