GNU bug report logs -
#14191
24.3.50; (buffer-list) returns list with non-current buffer as its first element
Previous Next
Reported by: Joost Kremers <joostkremers <at> fastmail.fm>
Date: Fri, 12 Apr 2013 12:39:03 UTC
Severity: normal
Merged with 14415
Found in versions 24.3.50, 24.3.50.1
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#14191: 24.3.50; (buffer-list) returns list with non-current buffer as its first element
which was filed against the emacs package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 14191 <at> debbugs.gnu.org.
--
14191: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14191
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
> - 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;
}
[Message part 3 (message/rfc822, inline)]
(buffer-list) returns a list of buffers, but the first buffer in the
list is not the current buffer.
Recipe to reproduce:
- start Emacs with `emacs -Q'
- M-x ielm RET
- at the prompt, type (buffer-list)
Output (list of buffers wrapped for better readability):
,----
| *** Welcome to IELM *** Type (describe-mode) for help.
| ELISP> (buffer-list)
| (#<buffer *scratch*> #<buffer *Minibuf-1*> #<buffer *Minibuf-0*>
| #<buffer *Messages*> #<buffer *code-conversion-work*>
| #<buffer *Echo Area 0*> #<buffer *Echo Area 1*> #<buffer *ielm*>)
`----
Although the *ielm* buffer is current, the first buffer in the list is
the *scratch* buffer.
Doing the same thing in an Emacs Debian (Ubuntu) snapshot from a few
weeks ago:
,----
| *** Welcome to IELM *** Type (describe-mode) for help.
| ELISP> (buffer-list)
| (#<buffer *ielm*> #<buffer *scratch*> #<buffer *Minibuf-1*>
| #<buffer *Minibuf-0*> #<buffer *Messages*>
| #<buffer *code-conversion-work*> #<buffer *Echo Area 0*>
| #<buffer *Echo Area 1*>)
|
| ELISP> (emacs-version)
| "GNU Emacs 24.3.50.1 (i686-pc-linux-gnu)\n of 2013-03-19 on gold, modified by Debian"
`----
Here, the output of buffer-list has the *ielm* buffer as its first
element. (Note, I've included the output of (emacs-version) here: this
is obviously *not* the version in which the bug occurs. That version is
given below.)
Note that I'm just using the *ielm* buffer to show the output of
(buffer-list). It has nothing to do with the bug itself. Using `M-x eval
RET (buffer-list) RET' gives the same result, as does using
(buffer-list) in Elisp. (Which is how I ran into the bug: swbuff.el from
http://emhacks.sourceforge.net/ stopped working properly. I traced the
problem to this changed behaviour of buffer-list.)
HTH
Joost Kremers
In GNU Emacs 24.3.50.1 (i686-pc-linux-gnu, GTK+ Version 3.6.0)
of 2013-04-11 on fermium, modified by Debian
(emacs-snapshot package, version 2:20130410-1~ppa1~quantal1)
Windowing system distributor `The X.Org Foundation', version 11.0.11300000
System Description: Ubuntu 12.10
Configured using:
`configure --build i686-linux-gnu --host i686-linux-gnu --prefix=/usr
--sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var
--infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.3.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3.50/site-lisp:/usr/share/emacs/site-lisp
--without-compress-info --with-crt-dir=/usr/lib/i386-linux-gnu/
--with-x=yes --with-x-toolkit=gtk3 --with-imagemagick=yes
CFLAGS='-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2'
CPPFLAGS='-D_FORTIFY_SOURCE=2' LDFLAGS='-g -Wl,--as-needed
-znocombreloc''
Important settings:
value of $LC_MONETARY: en_US.UTF-8
value of $LC_NUMERIC: en_US.UTF-8
value of $LC_TIME: en_US.UTF-8
value of $LANG: en_GB.UTF-8
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t
Major mode: IELM
Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
M-x i e l m <return> ( b u f f e r - l i s t ) <return>
<help-echo> <help-echo> <help-echo> <up> <up> <up>
<up> C-a a <backspace> <up> <left> <left> <left> <left>
<left> <left> <left> C-SPC <down> <down> <down> <down>
<down> <down> M-w ( e m a c s - v e r s i o n ) <return>
<help-echo> <help-echo> <up> <up> <up> <right> C-SPC
<down> <down> M-w C-x C-g M-x e m a c <tab> b u <tab>
<M-backspace> <M-backspace> r e p <tab> o r <tab>
<return>
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set
End of buffer
Mark set
Making completion list...
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils help-mode easymenu ielm pp comint ansi-color ring
time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer loaddefs button faces cus-face macroexp files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)
--
Joost Kremers
Life has its moments
This bug report was last modified 12 years and 62 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.