emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When was the function 'get-scratch-buffer-create' introduced?


From: Philip Kaludercic
Subject: Re: When was the function 'get-scratch-buffer-create' introduced?
Date: Mon, 12 Dec 2022 19:51:31 +0000

Akib Azmain Turja <akib@disroot.org> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Akib Azmain Turja <akib@disroot.org> 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 <spwhitton@spwhitton.name>
>> 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!

What are you using the function for?  Would it make sense adding it to
Compat?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]