Subject: 24.3.50; (buffer-list) returns list with non-current buffer as its first element

From: Joost Kremers <[email-masked]>
Date: Fri, 12 Apr 2013 14:34:05 +0200

(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