[Top][All Lists]

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

bug#14604:; Possibly incorrect behaviour of frame-selected-win

From: E Sabof
Subject: bug#14604:; Possibly incorrect behaviour of frame-selected-window
Date: Wed, 30 Oct 2013 19:23:21 +0000



On Wed, Oct 30, 2013 at 5:50 PM, Stefan Monnier <address@hidden> wrote:
> (defvar user-selected-window nil)
> (defun register-user-location ()
>   (setq user-selected-window (selected-window)))
> (add-hook 'post-command-hook 'register-user-location)

> (setq-default
>   mode-line-format
>   '(:eval (if (eq user-selected-window (selected-window))
>               "selected"
>               "not-selected")))

That will usually work, except for corner-cases where redisplay happens
in the middle of a command, or when the selected window is modified
between commands (e.g. from a process sentinel).

You can make it reliable with the use of the new
`pre-redisplay-function' hook (instead of post-command-hook), which
I just added yesterday.

Of course, making it reliable doesn't mean it's not an omission.
I tend to agree that it would be good to provide access to that info
more directly.


reply via email to

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