From: Jonas Bernoulli <jonas@bernoul.li>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Let mode-line packages distinguish the selected-window
Date: Sat, 26 Oct 2019 21:27:29 +0200 [thread overview]
Message-ID: <877e4r5mu6.fsf@bernoul.li> (raw)
In-Reply-To: <jwvsgnfbhmo.fsf-monnier+emacs@gnu.org>
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> 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:
Well it seems I (or any of the maintainers of the other packages,
really) should have asked a bit earlier. oO
>> 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".
That's very promising indeed. The minibuffer window needs to be handled
a bit differently, I think:
(defun moody--set-active-window (_)
(let ((win (selected-window)))
(unless (minibuffer-window-active-p win)
(setq moody--active-window win))))
(add-hook 'pre-redisplay-functions #'moody--set-active-window)
>> 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.
That would be nice. (And no Eli, I don't have a patch ready. Not much
of a C guy. Not at all really.)
But even though I suggested something like that, I feel the
remembered-selected-window approach is a bit hackish. IMO it would be
nicer if instead of that variable regular selected-window would return
"that window" while a new function/variable named something like
mode-line-window returned the "window whose mode-line is currently being
updated". But that would be a breaking change, so maybe not.
Jonas
next prev parent reply other threads:[~2019-10-26 19:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-26 13:38 Let mode-line packages distinguish the selected-window Jonas Bernoulli
2019-10-26 14:01 ` Eli Zaretskii
2019-10-26 21:10 ` martin rudalics
2019-10-27 5:01 ` Eli Zaretskii
2019-10-27 7:48 ` martin rudalics
2019-10-27 21:13 ` Jonas Bernoulli
2019-10-28 9:40 ` martin rudalics
2019-10-28 10:32 ` Jonas Bernoulli
2019-10-29 9:27 ` martin rudalics
2019-10-29 12:24 ` Eli Zaretskii
2019-10-29 18:05 ` martin rudalics
2019-10-29 18:46 ` Eli Zaretskii
2019-10-30 8:14 ` martin rudalics
2019-10-30 16:10 ` Eli Zaretskii
2019-10-28 15:55 ` Eli Zaretskii
2019-10-29 11:50 ` Jonas Bernoulli
2019-10-26 16:36 ` Stefan Monnier
2019-10-26 19:27 ` Jonas Bernoulli [this message]
2019-10-26 19:41 ` Eli Zaretskii
2019-10-26 20:36 ` Stefan Monnier
2019-10-27 18:08 ` Jonas Bernoulli
2019-10-27 21:55 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877e4r5mu6.fsf@bernoul.li \
--to=jonas@bernoul.li \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.