Subject: bug#7381: 24.0.50; Provide a hook run when a window is selected

From: Stefan Monnier <[email-masked]>
Date: Fri, 12 Nov 2010 15:55:30 -0500

severity 7381 wishlist
thanks

> Use case: I wanted to make myself a command to select the last selected
> window (i.e., repeating the command would toggle between two windows).

We could add a select-window-hook, indeed.  We'd probably only want to
run it when the norecord argument is nil, but other than that I don't
see any good reason not to have such a thing (tho I don't see any
particularly strong reason to have such a thing either: your use case
makes sense, but it's not extremely important/useful since you can get
somewhat comparable results in many different ways, and I haven't seen
many other use cases yet).

It may come down to just adding the appropriate run_hooks call in
Fselect_window, but someone will first have to check all calls to
Fselect_window and make sure they can withstand running arbitrary Elisp
code (currently Fselect_window cannot cause Elisp code to be run, AFAICT).

        Stefan