summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.emacs6
1 files changed, 6 insertions, 0 deletions
diff --git a/.emacs b/.emacs
index 75662f1..e052b91 100644
--- a/.emacs
+++ b/.emacs
@@ -128,6 +128,12 @@
(defvar-local my/centered-width 'fill-column)
(defvar-local my/centered-set-right-margin nil)
+(defun my/centered--undo-margins (&optional _size window-to-split)
+ (when (buffer-local-value 'my/centered-mode (window-buffer window-to-split))
+ (set-window-margins window-to-split nil nil)))
+
+(advice-add 'split-window-right :before 'my/centered--undo-margins)
+
(define-minor-mode my/centered-mode
"Update margins to keep content centered."
:init-value nil