aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/simple.el19
2 files changed, 16 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index afd073f1216..fa46fdcf7d3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12008-12-31 Martin Rudalics <rudalics@gmx.at>
2
3 * simple.el (last-buffer): Don't set major mode of *scratch* if
4 that buffer exists already. Rewrite doc-string.
5
12008-12-31 Andreas Schwab <schwab@suse.de> 62008-12-31 Andreas Schwab <schwab@suse.de>
2 7
3 * tar-mode.el (tar-mode): Set write-contents-functions instead of 8 * tar-mode.el (tar-mode): Set write-contents-functions instead of
diff --git a/lisp/simple.el b/lisp/simple.el
index 386de773849..c5d036b1d9a 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -78,19 +78,22 @@ If BUFFER is non-nil, ignore occurrences of that buffer in LIST."
78 (car list))) 78 (car list)))
79 79
80(defun last-buffer (&optional buffer visible-ok frame) 80(defun last-buffer (&optional buffer visible-ok frame)
81 "Return the last non-hidden displayable buffer in the buffer list. 81 "Return the last buffer in FRAME's buffer list.
82If BUFFER is non-nil, last-buffer will ignore that buffer. 82If BUFFER is the last buffer, return the preceding buffer instead.
83Buffers not visible in windows are preferred to visible buffers, 83Buffers not visible in windows are preferred to visible buffers,
84unless optional argument VISIBLE-OK is non-nil. 84unless optional argument VISIBLE-OK is non-nil.
85If the optional third argument FRAME is non-nil, use that frame's 85Optional third argument FRAME nil or omitted means use the
86buffer list instead of the selected frame's buffer list. 86selected frame's buffer list.
87If no other buffer exists, the buffer `*scratch*' is returned." 87If no such buffer exists, return the buffer `*scratch*', creating
88it if necessary."
88 (setq frame (or frame (selected-frame))) 89 (setq frame (or frame (selected-frame)))
89 (or (get-next-valid-buffer (nreverse (buffer-list frame)) 90 (or (get-next-valid-buffer (nreverse (buffer-list frame))
90 buffer visible-ok frame) 91 buffer visible-ok frame)
91 (progn 92 (get-buffer "*scratch*")
92 (set-buffer-major-mode (get-buffer-create "*scratch*")) 93 (let ((scratch (get-buffer-create "*scratch*")))
93 (get-buffer "*scratch*")))) 94 (set-buffer-major-mode scratch)
95 scratch)))
96
94(defun next-buffer () 97(defun next-buffer ()
95 "Switch to the next buffer in cyclic order." 98 "Switch to the next buffer in cyclic order."
96 (interactive) 99 (interactive)