[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding olivetti to GNU ELPA
From: |
Joost Kremers |
Subject: |
Re: Adding olivetti to GNU ELPA |
Date: |
Tue, 14 May 2019 23:56:24 +0200 |
User-agent: |
mu4e 1.3.2; emacs 26.2 |
On Tue, May 14 2019, Stefan Monnier wrote:
(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,
Yes, specifically their width.
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.
Ah, I see.
The problem I ran into (and with prompted my remark above) was
that in Emacs 26, the functions in window-size-change-functions
are called with the frame as argument, even the functions in the
local part of the hook. In Emacs 27, the functions in the global
part are called with the frame as argument, while the functions in
the local part are called with the window as argument. Since the
function that `visual-fill-column-mode` puts in the hook assumes
the frame as argument, the simplest change seemed to be to put it
in the global part. It seems that wasn't the only solution, and
arguably it's not the best solution either...
I'll set up a VirtualBox so I can test it with Emacs 27 and make
the change when I have some time.
Thanks for the info.
--
Joost Kremers
Life has its moments
- Re: Adding olivetti to GNU ELPA, (continued)
- Re: Adding olivetti to GNU ELPA, Paul W. Rankin, 2019/05/14
- Re: Adding olivetti to GNU ELPA, Paul W. Rankin, 2019/05/14
- Re: Adding olivetti to GNU ELPA, Stefan Monnier, 2019/05/14
- Re: Adding olivetti to GNU ELPA, Paul W. Rankin, 2019/05/15
- Re: Adding olivetti to GNU ELPA, Joost Kremers, 2019/05/14
- Re: Adding olivetti to GNU ELPA, Stefan Monnier, 2019/05/14
- Re: Adding olivetti to GNU ELPA,
Joost Kremers <=
- Re: Adding olivetti to GNU ELPA, Stefan Monnier, 2019/05/14
- Re: Adding olivetti to GNU ELPA, martin rudalics, 2019/05/20
- Re: Adding olivetti to GNU ELPA, Paul W. Rankin, 2019/05/20
- Re: Adding olivetti to GNU ELPA, martin rudalics, 2019/05/21
- Re: Adding olivetti to GNU ELPA, Paul W. Rankin, 2019/05/21
- Re: Adding olivetti to GNU ELPA, martin rudalics, 2019/05/21
- Re: Adding olivetti to GNU ELPA, Paul W. Rankin, 2019/05/21
- Re: Adding olivetti to GNU ELPA, martin rudalics, 2019/05/21
- Re: Adding olivetti to GNU ELPA, Paul W. Rankin, 2019/05/21
- Re: Adding olivetti to GNU ELPA, martin rudalics, 2019/05/22