Subject: Re: bug#18233: 24.3.92; Use of (frame-selected-window) in mode-line-format

From: Stefan Monnier <[email-masked]>
Date: Sat, 09 Aug 2014 18:07:43 -0400

> I realise this subtle change is not exactly a bug.  The old behaviour is
> useful and used already, though.[1]

Yes, the old behavior was useful but was fundamentally problematic (by
breaking the equivalence between (selected-window) and
(frame-selected-window), which is otherwise always true).

Also it let you distinguish the one window that's the
frame-selected-window from the other windows in the same frame, but it
did not let you distinguish "the one and only selected-window".
For single-frame configs, there's no difference, but for multi-frame
configs, this usually isn't what was desired.

So we won't go back to the old behavior.  Instead we should provide
a new feature for that.  IIRC you can currently do it by hand with
something like:

(add-function :before pre-redisplay-function
              (lambda (_) (setq my-selected-window (selected-window))))

and then compare (deleted-window) to my-selected-window in your
mode-line-format.

        Stefan