[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Let mode-line packages distinguish the selected-window
From: |
Stefan Monnier |
Subject: |
Re: Let mode-line packages distinguish the selected-window |
Date: |
Sat, 26 Oct 2019 12:36:24 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> To deal with this the packages mentioned above resort to using several
> hook functions and advice to keep track of "the" selected window and
> then they do something like:
AFAIK since Emacs-24.4 only one hook is needed:
(add-function :before pre-redisplay-function
(lambda (_)
(setq remembered-selected-window (selected-window))))
or
(add-hook 'pre-redisplay-functions
(lambda (_) (setq remembered-selected-window (selected-window))))
> Because keeping remembered-selected-window up-to-date involves several
> hooks and advises this is rather ugly and fragile.
With `pre-redisplay-function(s)` is should be "easy and reliable".
> In summary, please add a way for functions that format elements of the
> mode-line to determine whether these elements are going to be used in
> the selected or some other window.
Despite what the above may suggest, I fully agree: while it's now easy
to "roll your own", this is a common need and we should provide this
info directly.
Stefan
- Re: Let mode-line packages distinguish the selected-window, (continued)
- Re: Let mode-line packages distinguish the selected-window, Eli Zaretskii, 2019/10/26
- Re: Let mode-line packages distinguish the selected-window, martin rudalics, 2019/10/26
- Re: Let mode-line packages distinguish the selected-window, Jonas Bernoulli, 2019/10/27
- Re: Let mode-line packages distinguish the selected-window, martin rudalics, 2019/10/28
- Re: Let mode-line packages distinguish the selected-window, Jonas Bernoulli, 2019/10/28
- Re: Let mode-line packages distinguish the selected-window, martin rudalics, 2019/10/29
- Re: Let mode-line packages distinguish the selected-window, Eli Zaretskii, 2019/10/28
- Re: Let mode-line packages distinguish the selected-window, Jonas Bernoulli, 2019/10/29
Re: Let mode-line packages distinguish the selected-window,
Stefan Monnier <=