emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding olivetti to GNU ELPA


From: Stefan Monnier
Subject: Re: Adding olivetti to GNU ELPA
Date: Tue, 14 May 2019 12:50:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> (defun visual-fill-column-mode--enable ()
>  "Set up `visual-fill-column-mode' for the current buffer."
>  (add-hook 'window-configuration-change-hook
> #'visual-fill-column--adjust-window 'append 'local)
>  (if (>= emacs-major-version 26)
>      (add-hook 'window-size-change-functions
> #'visual-fill-column--adjust-frame 'append))
>  (visual-fill-column--adjust-window))

If you fundamentally only care about the size of the windows, then in
Emacs-27 all you need is

      (add-hook 'window-size-change-functions
                #'visual-fill-column--adjust-window 'append 'local)

> frame. In Emacs 27, this function must be in the global part of
> `window-size-change-functions`,

Not really: in Emacs-26, if it's on the local-part of the hook, then it
will fail to be called when your window's size is changed as
a side-effect of some other window being resized (this is fixed in
Emacs-27).  In Emacs-27, on the contrary it can be in the local part of
the hook and can limit its action to the window passed as an argument
rather than having to cycle through all windows on the selected frame,
because the local part of the hook is run (separately) for every window
whose size has changed.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]