emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

switch-to-buffer incompatible behavior with Emacs 21


From: Max Mikhanosha
Subject: switch-to-buffer incompatible behavior with Emacs 21
Date: Wed, 23 Aug 2006 23:03:46 -0400
User-agent: Wanderlust/2.15.3 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.0.51 (x86_64-unknown-linux-gnu) MULE/5.0 (SAKAKI)

I've tried using http://www.emacswiki.org/cgi-bin/wiki/CycleBuffer
package and noticed that it does not function correctly on Emacs 22.

The above package uses (switch-to-buffer <buffer> t) when fast
forwarding thru all buffers, in order to avoid recording all the
buffers that user quickly flips thru as recent. Then once user had
selected the buffer they want, it does (switch-to-buffer
(current-buffer)). Under Emacs 21 that moves the buffer to the head of
the buffer list, but under Emacs 22 it fails to do so.

Here is a simple test case from scratch buffer

;; evaluate below first to create 2 buffers
(progn
  (find-file "buffer1")
  (find-file "buffer2"))

;; Switch back to *scratch* buffer and evaluate below form:
;; Under Emacs 21 the form returns buffer1, and under Emacs 22
;; the form returns *scratch*
(progn
  (switch-to-buffer (get-buffer "buffer1") t)
  (switch-to-buffer (get-buffer "buffer1"))
  (car (buffer-list)))
 
The following patch fixes the problem

-----------------------------------------------
Index: buffer.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/buffer.c,v
retrieving revision 1.507
diff -u -r1.507 buffer.c
--- buffer.c    22 Aug 2006 09:25:59 -0000      1.507
+++ buffer.c    24 Aug 2006 02:44:03 -0000
@@ -1683,7 +1683,8 @@
 {
   char *err;
 
-  if (EQ (buffer, Fwindow_buffer (selected_window)))
+  if (EQ (buffer, Fwindow_buffer (selected_window))
+      && (! NILP (norecord) || EQ (buffer, XCDR (XCAR (Vbuffer_alist)))))
     /* Basically a NOP.  Avoid signalling an error if the selected window
        is dedicated, or a minibuffer, ...  */
     return Fset_buffer (buffer);
-----------------------------------------------

Regards,
  Max




reply via email to

[Prev in Thread] Current Thread [Next in Thread]