Subject: bug#1237: 23.0.60; `switch-to-buffer-other-window' sometimes uses selected window

From: martin rudalics <[email-masked]>
Date: Sat, 25 Oct 2008 19:00:39 +0200

> Would it suffice if `run_window_configuration_change_hook' re-selected
 > the selected window at the end? i.e.,

It should handle your two windows case.  I'm not sure what happens with
three or more windows.  The problem is that we want the _least_ recently
used window and the `select-window' would not fix anything messed up
down there.  In some sense this virtual list of windows ordered by their
use_time gets rotated with every call of `walk-windows'.

The real problem is the unholy combination of
run_window_configuration_change_hook and `walk-windows'.  The former
carefully selects each window _without_ recording it and the latter
annihilates the former's efforts by selecting the window _and_ recording
it.  I tried with a `save-selected-window-norecord' macro and equipped
`set-frame-selected-window' with an extra "norecord" parameter.  This
works but is quite clumsy.  Also, I'm by no means sure whether the
effect of recorded selecting a window within `walk-windows' might have
been considered a feature by other callers.

martin