changeset 1252:86a17674c2a1

* buffer.c (Fbury_buffer): This used to undisplay the buffer being buried only if the BUFFER argument was nil. Instead, undisplay the buffer whenever it's displayed in the selected window, no matter how it was specified by BUFFER. This is how it behaves in 18.58, and I can't find any ChangeLog entry in 18.58 or 19.0 saying why they differ. Fix the doc string accordingly.
author Jim Blandy <jimb@redhat.com>
date Tue, 29 Sep 1992 04:08:04 +0000
parents 4e556fda7a4d
children 7afcf7be0d30
files src/buffer.c
diffstat 1 files changed, 20 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/buffer.c	Tue Sep 29 03:38:03 1992 +0000
+++ b/src/buffer.c	Tue Sep 29 04:08:04 1992 +0000
@@ -912,18 +912,14 @@
   "Put BUFFER at the end of the list of all buffers.\n\
 There it is the least likely candidate for `other-buffer' to return;\n\
 thus, the least likely buffer for \\[switch-to-buffer] to select by default.\n\
-If the argument is nil, bury the current buffer\n\
-and switch to some other buffer in the selected window.")
+BUFFER is also removed from the selected window if it was displayed there.\n\
+If BUFFER is omitted, the current buffer is buried.")
   (buf)
      register Lisp_Object buf;
 {
-  register Lisp_Object aelt, link;
-
+  /* Figure out what buffer we're going to bury.  */
   if (NILP (buf))
-    {
-      XSET (buf, Lisp_Buffer, current_buffer);
-      Fswitch_to_buffer (Fother_buffer (buf), Qnil);
-    }
+    XSET (buf, Lisp_Buffer, current_buffer);
   else
     {
       Lisp_Object buf1;
@@ -932,13 +928,23 @@
       if (NILP (buf1))
 	nsberror (buf);
       buf = buf1;
-    }	  
+    }
+
+  /* Remove it from the screen.  */
+  if (EQ (buf, XWINDOW (selected_frame)->buffer))
+    Fswitch_to_buffer (Fother_buffer (buf), Qnil);
 
-  aelt = Frassq (buf, Vbuffer_alist);
-  link = Fmemq (aelt, Vbuffer_alist);
-  Vbuffer_alist = Fdelq (aelt, Vbuffer_alist);
-  XCONS (link)->cdr = Qnil;
-  Vbuffer_alist = nconc2 (Vbuffer_alist, link);
+  /* Move it to the end of the buffer list.  */
+  {
+    register Lisp_Object aelt, link;
+
+    aelt = Frassq (buf, Vbuffer_alist);
+    link = Fmemq (aelt, Vbuffer_alist);
+    Vbuffer_alist = Fdelq (aelt, Vbuffer_alist);
+    XCONS (link)->cdr = Qnil;
+    Vbuffer_alist = nconc2 (Vbuffer_alist, link);
+  }
+
   return Qnil;
 }