diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2022-10-02 17:15:35 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2022-10-02 17:21:39 +0200 |
| commit | 89fa73ae2ab55eb9513a623fcf086115c398eec6 (patch) | |
| tree | f8f07af8bf3ff8e7e2e41ad1c61be03b3e5f71d1 /.emacs | |
| parent | e78bde323b1f62a6851c12e10e130215b0d08c3b (diff) | |
| download | dotfiles-89fa73ae2ab55eb9513a623fcf086115c398eec6.tar.xz | |
Unset margins before attempting to split window
Emacs seems to take margins into account when deciding whether a
window can be split horizontally. So with my current personal config,
a full-width Gnus article window would have huge margins, and could
not be split horizontally because a half-width window would not have
enough room for these margins.
Diffstat (limited to '.emacs')
| -rw-r--r-- | .emacs | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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 |
