GNU bug report logs - #18233
24.3.92; Use of (frame-selected-window) in mode-line-format

Previous Next

Package: emacs;

Reported by: Christopher Schmidt <ch <at> ristopher.com>

Date: Sat, 9 Aug 2014 21:19:01 UTC

Severity: wishlist

Found in version 24.3.92

Done: Christopher Schmidt <ch <at> ristopher.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18233 in the body.
You can then email your comments to 18233 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18233; Package emacs. (Sat, 09 Aug 2014 21:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Schmidt <ch <at> ristopher.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 09 Aug 2014 21:19:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Schmidt <ch <at> ristopher.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.92; Use of (frame-selected-window) in mode-line-format
Date: Sat,  9 Aug 2014 17:18:16 -0400 (EDT)
severity: wishlist

    emacs -q
    C-x 2
    M-: (push '(:eval (if (eq (frame-selected-window)
                              (selected-window))
                          "A" "B"))
              mode-line-format) RET

Both mode-lines expose an 'A'-Marker.

In Emacs 24.3 the mode-line of the window that is not the user selected
one is marked with 'B'.

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

[1] https://github.com/milkypostman/highline/blob/1621662e886afa5948e8fccf0037d6c2a718e9a0/highline.el#L326




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18233; Package emacs. (Sat, 09 Aug 2014 22:09:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#18233: 24.3.92;
 Use of (frame-selected-window) in mode-line-format
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




Reply sent to Christopher Schmidt <ch <at> ristopher.com>:
You have taken responsibility. (Sat, 09 Aug 2014 22:23:02 GMT) Full text and rfc822 format available.

Notification sent to Christopher Schmidt <ch <at> ristopher.com>:
bug acknowledged by developer. (Sat, 09 Aug 2014 22:23:03 GMT) Full text and rfc822 format available.

Message #13 received at 18233-done <at> debbugs.gnu.org (full text, mbox):

From: Christopher Schmidt <ch <at> ristopher.com>
To: 18233-done <at> debbugs.gnu.org
Subject: Re: bug#18233: 24.3.92;
 Use of (frame-selected-window) in mode-line-format
Date: Sat,  9 Aug 2014 18:22:06 -0400 (EDT)
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> 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.

Works great.  Thanks a lot!




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 07 Sep 2014 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 290 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.