summaryrefslogtreecommitdiff
path: root/lisp/bindings.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2002-07-21 20:23:32 +0000
committerRichard M. Stallman <rms@gnu.org>2002-07-21 20:23:32 +0000
commit196a1cba666ecaad74e49d143489e3048605ab53 (patch)
tree81b9dcd154699ad9628f9988a4d8e79667b581ae /lisp/bindings.el
parent24b01ec4c296fedb050390613337903aab1f67a3 (diff)
downloademacs-196a1cba666ecaad74e49d143489e3048605ab53.tar.gz
(last-buffer): Use buffer-list with frame arg.
Create *scratch* if no other choice exists. Fix bugs.
Diffstat (limited to 'lisp/bindings.el')
-rw-r--r--lisp/bindings.el22
1 files changed, 11 insertions, 11 deletions
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 10f84c94bac..139232ea0ec 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -277,24 +277,24 @@ Keymap for what is displayed by `mode-line-buffer-identification'.")
Return the last non-hidden buffer in the buffer list."
;; This logic is more or less copied from bury-buffer,
;; except that we reverse the buffer list.
- (let ((fbl (frame-parameter nil 'buffer-list))
- (list (buffer-list))
+ (let ((list (nreverse (buffer-list (selected-frame))))
(pred (frame-parameter nil 'buffer-predicate))
found notsogood)
- ;; Merge the frame buffer list with the whole buffer list,
- ;; and reverse it.
- (dolist (buffer fbl)
- (setq list (delq buffer list)))
- (setq list (nreverse (append fbl list)))
- (while (not found)
+ (while (and list (not found))
(unless (or (eq (aref (buffer-name (car list)) 0) ? )
;; If the selected frame has a buffer_predicate,
;; disregard buffers that don't fit the predicate.
(and pred (not (funcall pred (car list)))))
(if (get-buffer-window (car list) 'visible)
- (unless notsogood (setq notsogood (car list)))
- (setq found (car list)))))
- (or found notsogood)))
+ (or notsogood (eq (car list) (current-buffer)))
+ (setq found (car list))))
+ (pop list))
+ (or found notsogood
+ (get-buffer "*scratch*")
+ (progn
+ (set-buffer-major-mode
+ (get-buffer-create "*scratch*"))
+ (get-buffer "*scratch*")))))
(defun unbury-buffer () "\
Switch to the last buffer in the buffer list."