diff options
Diffstat (limited to '.emacs')
| -rw-r--r-- | .emacs | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -126,6 +126,7 @@ (message "changed from %s to %s" old-width new-width))) (defvar-local my/centered-width 'fill-column) +(defvar-local my/centered-set-right-margin nil) (define-minor-mode my/centered-mode "Update margins to keep content centered." @@ -150,11 +151,12 @@ (adjustable-width (- (window-total-width window) (+ (fringe-columns 'left) (fringe-columns 'right)))) - (target-margin + (left-margin (when (> adjustable-width target-body-width) - (/ (- adjustable-width target-body-width) 2)))) - ;; Only set left margin, so that long lines are not truncated. - (set-window-margins window target-margin)))) + (/ (- adjustable-width target-body-width) 2))) + (right-margin (and my/centered-set-right-margin + left-margin))) + (set-window-margins window left-margin right-margin)))) (defun my/kill (stuff) (kill-new stuff) |
