summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/simple.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index d638e641c3e..861d9eefde9 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -10213,6 +10213,17 @@ This is an integer indicating the UTC offset in seconds, i.e.,
the number of seconds east of Greenwich.")
)
+(defun scratch-buffer ()
+ "Switch to the \*scratch\* buffer.
+If the buffer doesn't exist, create it first."
+ (interactive)
+ (if (get-buffer "*scratch*")
+ (pop-to-buffer-same-window "*scratch*")
+ (pop-to-buffer-same-window (get-buffer-create "*scratch*"))
+ (when initial-scratch-message
+ (insert initial-scratch-message))
+ (funcall initial-major-mode)))
+
(provide 'simple)