XEmacs 21.2.32 "Kastor & Polydeukes".
[chise/xemacs-chise.git.1] / lisp / buffer.el
index 44f9221..983a55e 100644 (file)
@@ -34,9 +34,9 @@
 
 (defun switch-to-buffer (bufname &optional norecord)
   "Select buffer BUFNAME in the current window.
-BUFNAME may be a buffer or a buffer name and is created if did not exist.
-Optional second arg NORECORD non-nil means
-do not put this buffer at the front of the list of recently selected ones.
+BUFNAME may be a buffer or a buffer name and is created if it did not exist.
+Optional second arg NORECORD non-nil means do not put this buffer at the
+front of the list of recently selected ones.
 
 WARNING: This is NOT the way to work on another buffer temporarily
 within a Lisp program!  Use `set-buffer' instead.  That avoids messing with
@@ -60,11 +60,7 @@ the window-buffer correspondences."
            (set-buffer-major-mode buf))))
     (push-window-configuration)
     (set-buffer buf)
-    (or norecord (record-buffer buf))
-    (set-window-buffer (if (eq (selected-window) (minibuffer-window))
-                          (next-window (minibuffer-window))
-                        (selected-window))
-                      buf)
+    (set-window-buffer (last-nonminibuf-window) buf norecord)
     buf))
 
 (defun pop-to-buffer (bufname &optional not-this-window-p on-frame)