emacs-devel
[Top][All Lists]
Advanced

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

Re: Temporarily select-window, without updating mode-line face and curso


From: martin rudalics
Subject: Re: Temporarily select-window, without updating mode-line face and cursor fill?
Date: Mon, 3 May 2021 19:32:08 +0200

> 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




reply via email to

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