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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1237 in the body.
You can then email your comments to 1237 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-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: Markus Triska <markus.triska <at> gmx.at>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.60; `switch-to-buffer-other-window' sometimes uses selected window
Date: Fri, 24 Oct 2008 12:27:30 +0200 (CEST)
When you do:

   $ emacs -Q -f linum-mode

and then:

   C-x 2

you obtain one frame with two windows, the one on top being selected.

When you then do:

   M-: (switch-to-buffer-other-window "test") RET

the selected window is unexpectedly reused to display the new buffer.

In GNU Emacs 23.0.60.11 (i386-apple-darwin8.11.1, GTK+ Version 2.12.9)
 of 2008-10-14 on mt-computer.local
Windowing system distributor `The XFree86 Project, Inc', version 11.0.40400000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #10 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 14:28:04 +0200
> When you do:
>
>    $ emacs -Q -f linum-mode
>
> and then:
>
>    C-x 2
>
> you obtain one frame with two windows, the one on top being selected.
>
> When you then do:
>
>    M-: (switch-to-buffer-other-window "test") RET
>
> the selected window is unexpectedly reused to display the new buffer.

FWIW, the problem seems that `linum-mode' indirectly changes the value
of windows' use_time so the value returned by `get-lru-window' is messy.
use_time is updated by `select-window', hence a potential culprit is
`walk-windows' which is used by `linum-mode'.  Could you try to find out
whether my guess is correct and/or where and how use_time is set when
`linum-mode' is active?

Thanks, martin





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: Markus Triska <markus.triska <at> gmx.at>
To: martin rudalics <rudalics <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 16:06:17 +0200
martin rudalics <rudalics <at> gmx.at> writes:

> of windows' use_time so the value returned by `get-lru-window' is messy.
> use_time is updated by `select-window', hence a potential culprit is
> `walk-windows' which is used by `linum-mode'.

You are right that `get-lru-window' seems not to do the right thing in
effect (it evaluates to the currently selected window even though there
is another one in the frame). `select-window' seems not to be called in
`walk-windows' as used by linum though, since the third argument is not
a frame. I found that when you set `window-configuration-change-hook' to
nil in *scratch* before `switch-to-buffer-other-window', it chooses the
right buffer. I do not yet know if/where use_time changes.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #20 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 16:45:53 +0200
> I found that when you set `window-configuration-change-hook' to
> nil in *scratch* before `switch-to-buffer-other-window', it chooses the
> right buffer.

Does it change anything when you remove the `walk-windows' from your
function?  Then we would know that `walk-windows' is responsible for
triggering it.  Maybe run_window_configuration_change_hook messes it up
after `walk-windows'.

> I do not yet know if/where use_time changes.

Could you try to run this with GDB, set a breakpoint in select_window at
the

      XSETFASTINT (w->use_time, window_select_count);

line, and get a backtrace when(ever) this is hit for the lower window?

martin




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: Markus Triska <markus.triska <at> gmx.at>
To: martin rudalics <rudalics <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 17:42:54 +0200
I constructed the following self-contained case that I hope helps you:

   (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.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: 1237 <at> debbugs.gnu.org
Cc: Markus Triska <markus.triska <at> gmx.at>
Subject: Re: bug#1237: 23.0.60;	`switch-to-buffer-other-window' sometimes
 uses selected window
Date: Sat, 25 Oct 2008 15:28:12 +0200
> 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 :-(

OK.  The reason may be twofold: `save-selected-window' may twice
select a window with norecord nil:

		(set-frame-selected-window (car elt) (cdr elt)))) ; <--- here
	 (if (window-live-p save-selected-window-window)
	     (select-window save-selected-window-window)))))) <--- and here

Fixing these two fixes the bug.  I have to find out how to do this in an
unobtrusive way though.

martin, who'd never ever run `window-configuration-change-hook'
buffer-locally in the first place ;-)





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: Markus Triska <markus.triska <at> gmx.at>
To: martin rudalics <rudalics <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: Sat, 25 Oct 2008 18:09:28 +0200
martin rudalics <rudalics <at> gmx.at> writes:

> 		(set-frame-selected-window (car elt) (cdr elt)))) ; <--- here
> 	 (if (window-live-p save-selected-window-window)
> 	     (select-window save-selected-window-window)))))) <--- and here
>
> Fixing these two fixes the bug.  I have to find out how to do this in an
> unobtrusive way though.

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

2008-10-25  Markus Triska  <markus.triska <at> gmx.at>

	* window.c (run_window_configuration_change_hook): Re-select the
	selected window, to get the most recently used window right.

diff --git a/src/window.c b/src/window.c
index 5931955..28e089a 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3382,6 +3382,9 @@ run_window_configuration_change_hook (struct frame *f)
       }
   }
 
+  /* Make sure that the selected window remains most recently used. */
+  Fselect_window (Fselected_window (), Qnil);
+
   run_funs (global_wcch);
   unbind_to (count, Qnil);
 }




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #45 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: 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





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Markus Triska <markus.triska <at> gmx.at>
Cc: 1237 <at> debbugs.gnu.org, martin rudalics <rudalics <at> gmx.at>
Subject: Re: bug#1237: 23.0.60; `switch-to-buffer-other-window' sometimes uses selected window
Date: Sat, 25 Oct 2008 15:08:10 -0400
> I constructed the following self-contained case that I hope helps you:

>    (defun my-walk () (walk-windows 'identity))
>    (add-hook 'window-configuration-change-hook 'my-walk nil t)
>    (split-window)
>    (switch-to-buffer-other-window "test")

In Emacs-22, window-configuration-change-hook did not work correctly
with buffer-local hooks, but in some cases you could make it work
somewhat by using `walk-window' in your hook to try and cover all the
affected windows.

With the code I installed to properly support buffer-local hooks on
window-configuration-change-hook, the walk-window should be unnecessary,
so the patch below should not break linum and might remove the problem.

This said, walk-windows should probably use `norecord', what do
people think?


        Stefan


=== modified file 'lisp/linum.el'
--- lisp/linum.el	2008-08-31 19:46:54 +0000
+++ lisp/linum.el	2008-10-25 19:06:30 +0000
@@ -82,17 +82,22 @@
                                            'linum-update-current) nil t)
           (add-hook 'after-change-functions 'linum-after-change nil t))
         (add-hook 'window-scroll-functions 'linum-after-scroll nil t)
+        ;; FIXME: using both window-size-change-functions and
+        ;; window-configuration-change-hook seems redundant.
         (add-hook 'window-size-change-functions 'linum-after-size nil t)
         (add-hook 'change-major-mode-hook 'linum-delete-overlays nil t)
         (add-hook 'window-configuration-change-hook
-                  'linum-after-config nil t)
+                  ;; FIXME: If the buffer is shows in N windows, this
+                  ;; will be called N times rather than once.  We should use
+                  ;; something like linum-update-window instead.
+                  'linum-update-current nil t)
         (linum-update-current))
     (remove-hook 'post-command-hook 'linum-update-current t)
     (remove-hook 'post-command-hook 'linum-schedule t)
     (remove-hook 'window-size-change-functions 'linum-after-size t)
     (remove-hook 'window-scroll-functions 'linum-after-scroll t)
     (remove-hook 'after-change-functions 'linum-after-change t)
-    (remove-hook 'window-configuration-change-hook 'linum-after-config t)
+    (remove-hook 'window-configuration-change-hook 'linum-update-current t)
     (remove-hook 'change-major-mode-hook 'linum-delete-overlays t)
     (linum-delete-overlays)))
 





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <markus.triska <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: Markus Triska <markus.triska <at> gmx.at>
To: gnu-emacs-bug <at> moderators.isc.org
Subject: Re: bug#1237: 23.0.60; `switch-to-buffer-other-window' sometimes uses selected window
Date: Wed, 29 Oct 2008 14:25:54 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> This said, walk-windows should probably use `norecord', what do
> people think?

Yes, I find it very desirable that `walk-windows' have no side-effects.






Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Lennart Borgman" <lennart.borgman <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: "Lennart Borgman" <lennart.borgman <at> gmail.com>
To: "Markus Triska" <markus.triska <at> gmx.at>, 1237 <at> debbugs.gnu.org
Cc: gnu-emacs-bug <at> moderators.isc.org
Subject: Re: bug#1237: 23.0.60; `switch-to-buffer-other-window' sometimes uses selected window
Date: Wed, 29 Oct 2008 23:15:06 +0100
On Wed, Oct 29, 2008 at 2:25 PM, Markus Triska <markus.triska <at> gmx.at> wrote:
> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
>> This said, walk-windows should probably use `norecord', what do
>> people think?
>
> Yes, I find it very desirable that `walk-windows' have no side-effects.

Me too.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Lennart Borgman" <lennart.borgman <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: 1237 <at> debbugs.gnu.org
Subject: Re: bug#1237: 23.0.60;	`switch-to-buffer-other-window' sometimes
 uses selected window
Date: Sat, 01 Nov 2008 19:06:08 +0100
I've been looking into this and found out that in order to fix problems
in this area we need an optional "norecord" argument for `select-frame'
and `set-frame-selected-window'.  Both of these may (indirectly) call
`select-window' and thus mess with the order of recently selected
windows (and probably also the buffer list).

As a rule, the norecord argument would be set by `with-selected-window'
and `with-selected-frame' in addition to `walk-windows'.  Personally,
I'd set it in `save-selected-window' too, but this might break
applications that rely on the implicit selection provided by the current
mechanism.

The changes are trivial and not very interesting to post.  So please
tell me whether you want them installed.

martin





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: martin rudalics <rudalics <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: Sat, 01 Nov 2008 22:16:47 -0400
> I've been looking into this and found out that in order to fix problems
> in this area we need an optional "norecord" argument for `select-frame'
> and `set-frame-selected-window'.  Both of these may (indirectly) call
> `select-window' and thus mess with the order of recently selected
> windows (and probably also the buffer list).

> As a rule, the norecord argument would be set by `with-selected-window'
> and `with-selected-frame' in addition to `walk-windows'.  Personally,
> I'd set it in `save-selected-window' too, but this might break
> applications that rely on the implicit selection provided by the current
> mechanism.

> The changes are trivial and not very interesting to post.  So please
> tell me whether you want them installed.

That sounds good, please install them.


        Stefan






Reply sent to martin rudalics <rudalics <at> gmx.at>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Markus Triska <markus.triska <at> gmx.at>:
bug acknowledged by developer. Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: 1237-done <at> debbugs.gnu.org
Cc: Markus Triska <markus.triska <at> gmx.at>
Subject: Re: bug#1237: 23.0.60;	`switch-to-buffer-other-window' sometimes
 uses selected window
Date: Sun, 02 Nov 2008 12:14:05 +0100
Fixed as

2008-11-02  Martin Rudalics  <rudalics <at> gmx.at>

	* window.el (save-selected-window-norecord): New macro
	(walk-windows): Use save-selected-window-norecord and call
	select-window with NORECORD set.  (Bug#1237)

Thanks for the report, martin




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to rms <at> gnu.org:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: "Richard M. Stallman" <rms <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>, 1237 <at> debbugs.gnu.org
Cc: rudalics <at> gmx.at, bug-submit-list <at> donarmstrong.com,
        1237 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
Subject: Re: bug#1237: 23.0.60;
	`switch-to-buffer-other-window' sometimes uses selected window
Date: Sun, 02 Nov 2008 18:19:25 -0500
    > As a rule, the norecord argument would be set by `with-selected-window'
    > and `with-selected-frame' in addition to `walk-windows'.  Personally,
    > I'd set it in `save-selected-window' too, but this might break
    > applications that rely on the implicit selection provided by the current
    > mechanism.

I think it is very important to keep `with-selected-window'
and `save-selected-window' similar.  If we make this change
in one, we had better make the change in the other too.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to rms <at> gnu.org:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: rms <at> gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 1237 <at> debbugs.gnu.org
Subject: Re: bug#1237: 23.0.60;	`switch-to-buffer-other-window' sometimes
 uses selected window
Date: Mon, 03 Nov 2008 08:17:04 +0100
> I think it is very important to keep `with-selected-window'
> and `save-selected-window' similar.  If we make this change
> in one, we had better make the change in the other too.

I think so too.  But the behavior was different (in the NORECORD aspect)
already before my recent change.

martin





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to rms <at> gnu.org:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: "Richard M. Stallman" <rms <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: monnier <at> iro.umontreal.ca, 1237 <at> debbugs.gnu.org
Subject: Re: bug#1237: 23.0.60;	`switch-to-buffer-other-window' sometimes
 uses selected window
Date: Mon, 03 Nov 2008 14:40:31 -0500
     > I think it is very important to keep `with-selected-window'
     > and `save-selected-window' similar.  If we make this change
     > in one, we had better make the change in the other too.

    I think so too.  But the behavior was different (in the NORECORD aspect)
    already before my recent change.

Was that intentional or was it a bug?




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: rms <at> gnu.org
Cc: martin rudalics <rudalics <at> gmx.at>, 1237 <at> debbugs.gnu.org
Subject: Re: bug#1237: 23.0.60;	`switch-to-buffer-other-window' sometimes uses selected window
Date: Mon, 03 Nov 2008 15:49:35 -0500
>> I think it is very important to keep `with-selected-window'
>> and `save-selected-window' similar.  If we make this change
>> in one, we had better make the change in the other too.

>     I think so too.  But the behavior was different (in the NORECORD aspect)
>     already before my recent change.

> Was that intentional or was it a bug?

The fact that with-selected-window does not "record" it very
much intentional.  The "norecord" argument was added (to select-window)
specifically for that purpose.

I believe its absence in save-selected-window is only accidental.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1237; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: rms <at> gnu.org, 1237 <at> debbugs.gnu.org
Subject: Re: bug#1237: 23.0.60;	`switch-to-buffer-other-window' sometimes
 uses selected window
Date: Tue, 04 Nov 2008 08:35:37 +0100
> The fact that with-selected-window does not "record" it very
> much intentional.  The "norecord" argument was added (to select-window)
> specifically for that purpose.
>
> I believe its absence in save-selected-window is only accidental.

I hopefully removed all accidental absences by now ;-)

martin




bug archived. Request was from Debbugs Internal Request <don <at> donarmstrong.com> to internal_control <at> emacsbugs.donarmstrong.com. (Tue, 02 Dec 2008 15:24:03 GMT) Full text and rfc822 format available.

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.