diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2022-05-02 12:26:31 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-05-02 12:26:31 +0200 |
commit | 10f347a06286272c7dcfdeb47b3511b6f53adcbd (patch) | |
tree | d10135206258d68ce25f21face8532c7ead4de0e /lisp | |
parent | 2fba71cf1fadc9d681e6be250d152cc156bf6a00 (diff) | |
download | emacs-10f347a06286272c7dcfdeb47b3511b6f53adcbd.tar.gz emacs-10f347a06286272c7dcfdeb47b3511b6f53adcbd.tar.bz2 emacs-10f347a06286272c7dcfdeb47b3511b6f53adcbd.zip |
Add a command to recreate the *scratch* buffer
* doc/emacs/building.texi (Lisp Interaction): Mention it.
* lisp/simple.el (scratch-buffer): New command.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/simple.el | 11 |
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) |