GNU bug report logs - #1237
23.0.60; `switch-to-buffer-other-window' sometimes uses selected window

Previous Next

Package: emacs;

Reported by: Markus Triska <markus.triska <at> gmx.at>

Date: Fri, 24 Oct 2008 10:35:03 UTC

Severity: normal

Done: martin rudalics <rudalics <at> gmx.at>

Bug is archived. No further changes may be made.

Full log


Message #30 received at 1237 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Markus Triska <markus.triska <at> gmx.at>
Cc: 1237 <at> debbugs.gnu.org
Subject: Re: bug#1237: 23.0.60;	`switch-to-buffer-other-window' sometimes
 uses selected window
Date: Fri, 24 Oct 2008 19:37:27 +0200
>    (defun my-walk () (walk-windows 'identity))
>
>    (add-hook 'window-configuration-change-hook 'my-walk nil t)
>
>    (split-window)
>
>    (switch-to-buffer-other-window "test")
>
> If you put these forms in the *scratch* buffer of "emacs -Q" and then
> evaluate them one after another, you should be able to see the problem.
> The problem does not occur if the hook is NOT made buffer-local.

Yes.  Replacing `split-window' by

(progn
  (split-window)
  (message "sel %s .. lru %s" (selected-window) (get-lru-window)))

shows the problem immediately.  Everything seems alright when you put
that message into my-walk.

run_window_configuration_change_hook selects each window before running
the hook buffer-locally which makes any reasoning (within the function
run by the hook) about which window will be selected when the command
completes void.  In addition it unwinds with select_window_norecord
which won't restore the current buffer when the selected window gets
reselected.  Both of these don't explain the problem that somewhere
`select-window' must get called with norecord nil :-(

martin





This bug report was last modified 16 years and 207 days ago.

Previous Next


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