From: martin rudalics <rudalics@gmx.at>
To: JD Smith <jdtsmith@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Temporarily select-window, without updating mode-line face and cursor fill?
Date: Mon, 3 May 2021 19:32:08 +0200 [thread overview]
Message-ID: <74920c94-594c-c63b-01c6-056a339d2c59@gmx.at> (raw)
In-Reply-To: <40C17378-A4BF-4E70-A77D-E5034FA42C91@gmail.com>
> For calculating the line number in a window which may or may not be
> selected, (format-mode-line "%l” 0 win) has a window argument, but it
> does *not* have a position argument. It takes its position from (as
> far as I can tell) the window-point of its window argument. So I need
> to move window-point and immediately restore it if I want to use
> format-mode-line. If the window were selected, a simple
> save-excursion would be enough. But I cannot first select the window
> or I get “mode line flashing". I need a mythical
> `save-excursion-in-window', if you will.
If you just want to evaluate forms like the above (format-mode-line "%l"
0 win) then all I said does not apply. I thought you wanted to do such
things via an :eval in the mode line format.
So I probably misunderstood you. If all you want to do is to exploit
the "%l" construct for getting the line number at window start or window
end, then `set-window-point' should at least not harm (though it might
not work due to scrolling).
> But I will certainly need set-window-start for handling mouse-based
> events on the mode line (click/drag/scroll). Perhaps I didn’t make it
> clear that set-window-start will only be called in mouse-based event
> callbacks on the mode line; apologies if so. If even this is
> problematic in your view, could you clarify the sort of “trouble” it
> would cause? Other mouse events in the mode-line call things like
> ‘previous-buffer, so it’s not clear to me why set-window-start would
> lead to any special issues when driven by mouse events.
If you mean `set-window-start' as the effect (or a side effect) of a
mouse-based event on the mode line I see no problem.
martin
next prev parent reply other threads:[~2021-05-03 17:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-01 18:46 Temporarily select-window, without updating mode-line face and cursor fill? JD Smith
2021-05-01 19:31 ` Eli Zaretskii
2021-05-01 20:32 ` JD Smith
2021-05-02 6:49 ` Eli Zaretskii
2021-05-03 2:15 ` JD Smith
2021-05-03 7:50 ` martin rudalics
2021-05-03 16:16 ` JD Smith
2021-05-03 17:32 ` martin rudalics [this message]
2021-05-02 7:40 ` martin rudalics
2021-05-03 2:23 ` JD Smith
2021-05-01 22:17 ` JD Smith
2021-05-02 6:55 ` Eli Zaretskii
2021-05-03 2:08 ` JD Smith
2021-05-03 2:25 ` Stefan Monnier
2021-05-03 2:49 ` JD Smith
2021-05-04 19:28 ` JD Smith
2021-05-04 19:40 ` Stefan Monnier
2021-05-05 0:49 ` Stefan Kangas
2021-05-05 11:54 ` Eli Zaretskii
2021-05-05 19:32 ` Stefan Kangas
2021-05-05 19:47 ` Stefan Monnier
2021-05-06 0:16 ` JD Smith
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=74920c94-594c-c63b-01c6-056a339d2c59@gmx.at \
--to=rudalics@gmx.at \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=jdtsmith@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).