Philip Kaludercic writes: > Akib Azmain Turja writes: > >> On Emacs 28, 'get-scratch-buffer-create' seems to be undefined. But >> there is no NEWS entry about introducing 'get-scratch-buffer-create'. >> >> When was this function introduced? >> >> [ Originally reported by cgenie at Workroom Codeberg repo. >> https://codeberg.org/akib/emacs-workroom/issues/1 ] > > This seems to have been the first commit: > > commit 054062060e9f57fd037578378c23ad9ec294edac > Author: Sean Whitton > Date: Thu May 5 13:03:06 2022 -0700 > > Factor out *scratch* initialization > > * lisp/simple.el (get-scratch-buffer-create): New function, factored > out of scratch-buffer, and additionally clearing the modification flag > and calling substitute-command-keys (bug#55257). > (scratch-buffer): > * lisp/server.el (server-execute): > * lisp/startup.el (normal-no-mouse-startup-screen, command-line-1): > * lisp/window.el (last-buffer, window-normalize-buffer-to-switch-to): > * src/buffer.c (Fother_buffer, other_buffer_safely): Use it. > (syms_of_buffer): Add Qget_scratch_buffer_create. > * lisp/startup.el (startup--get-buffer-create-scratch): Delete > now-unused function. > * doc/lispref/os.texi (Summary: Sequence of Actions at Startup): > * NEWS (Incompatible changes in Emacs 29.1): Document the change. > > diff --git a/lisp/simple.el b/lisp/simple.el > --- a/lisp/simple.el > +++ b/lisp/simple.el > @@ -10216,0 +10216,12 @@ > +(defun get-scratch-buffer-create () > + "Return the \*scratch\* buffer, creating a new one if needed." > + (or (get-buffer "*scratch*") > + (let ((scratch (get-buffer-create "*scratch*"))) > + ;; Don't touch the buffer contents or mode unless we know that > + ;; we just created it. > + (with-current-buffer scratch > + (when initial-scratch-message > + (insert (substitute-command-keys initial-scratch-message)) > + (set-buffer-modified-p nil)) > + (funcall initial-major-mode)) > + scratch))) > > So it is part of Emacs 29. > Thanks! -- Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5 Fediverse: akib@hostux.social Codeberg: akib emailselfdefense.fsf.org | "Nothing can be secure without encryption."