[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#14191: 24.3.50; (buffer-list) returns list with non-current buffer a
From: |
Stefan Monnier |
Subject: |
bug#14191: 24.3.50; (buffer-list) returns list with non-current buffer as its first element |
Date: |
Fri, 12 Apr 2013 13:32:58 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> - start Emacs with `emacs -Q'
> - M-x ielm RET
> - at the prompt, type (buffer-list)
[...]
> Although the *ielm* buffer is current, the first buffer in the list is
> the *scratch* buffer.
I've installed the patch below which should restore the old behavior.
Thanks for the nice test case.
Stefan
=== modified file 'src/window.c'
--- src/window.c 2013-04-11 16:06:47 +0000
+++ src/window.c 2013-04-12 17:30:35 +0000
@@ -489,7 +489,10 @@
Fset_buffer (w->contents);
if (EQ (window, selected_window) && !inhibit_point_swap)
- return window;
+ /* `switch-to-buffer' uses (select-window (selected-window)) as a "clever"
+ way to call record_buffer from Elisp, so it's important that we call
+ record_buffer before returning here. */
+ goto record_and_return;
sf = SELECTED_FRAME ();
if (XFRAME (WINDOW_FRAME (w)) != sf)
@@ -508,7 +511,10 @@
fset_selected_window (sf, window);
select_window_1 (window, inhibit_point_swap);
+ bset_last_selected_window (XBUFFER (w->contents), window);
+ windows_or_buffers_changed++;
+ record_and_return:
/* record_buffer can run QUIT, so make sure it is run only after we have
re-established the invariant between selected_window and selected_frame,
otherwise the temporary broken invariant might "escape" (bug#14161). */
@@ -518,8 +524,6 @@
record_buffer (w->contents);
}
- bset_last_selected_window (XBUFFER (w->contents), window);
- windows_or_buffers_changed++;
return window;
}
bug#14191: 24.3.50; (buffer-list) returns list with non-current buffer as its first element, Andreas Schwab, 2013/04/12