[Top][All Lists]

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

Re: Let mode-line packages distinguish the selected-window

From: martin rudalics
Subject: Re: Let mode-line packages distinguish the selected-window
Date: Mon, 28 Oct 2019 10:40:42 +0100

> And here is a weird edge case where doing so is not possible:
>    (add-hook 'pre-command-hook (lambda () (force-mode-line-update t)))
> Sure that is weird, but that's not the point.  With this hook function
> we can observe the following behavior:
> 1. Enter minibuffer.
> 2. Switch to another frame.  (Without leaving minibuffer first.)
> 3. Observe that the window which was the selected window before
>     (1) now uses mode-line-inactive but your code snippet returns t.

Running your example in an unmodified Emacs _without_ the hook you
sketched above gets me _two active_ mode-lines here (on a windowing
system that gives focus to a frame when the mouse enters it).  Running
it with the hook gets me an active mode-line for the window of the
focussed frame only.  I can't tell which of these is more distracting.

> I think the only 100% sure way to be able to answer the first question
> is to record that decision at the time when it is made.  Emphasize on
> both "that decision" (not some closely related one) and "at that time",
> i.e. when CURRENT_MODE_LINE_FACE_ID_3 is being called by
> display_mode_lines, then that value has to be saved in a way that is
> accessible from lisp.

Accessible only within the evaluation of 'mode-line-format'.

> Now I am not saying this absolutely has to be done.  I am quite happy
> with the above code.  But since I noticed this edge-case I though I
> would point it out in case you decide that this is something we cannot
> live with.

So maybe we should just provide a function called 'mode-line-active-p'
that returns non-nil when the window whose mode-line is just processed
is considered active (whether that decision is right or wrong) and not
talk about the selected window in the first place.


reply via email to

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