all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* When was the function 'get-scratch-buffer-create' introduced?
@ 2022-12-12  5:26 Akib Azmain Turja
  2022-12-12  8:17 ` Philip Kaludercic
  2022-12-12  8:18 ` Stefan Kangas
  0 siblings, 2 replies; 5+ messages in thread
From: Akib Azmain Turja @ 2022-12-12  5:26 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

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 ]

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: When was the function 'get-scratch-buffer-create' introduced?
  2022-12-12  5:26 When was the function 'get-scratch-buffer-create' introduced? Akib Azmain Turja
@ 2022-12-12  8:17 ` Philip Kaludercic
  2022-12-12 10:34   ` Akib Azmain Turja
  2022-12-12  8:18 ` Stefan Kangas
  1 sibling, 1 reply; 5+ messages in thread
From: Philip Kaludercic @ 2022-12-12  8:17 UTC (permalink / raw)
  To: Akib Azmain Turja; +Cc: emacs-devel

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:

--8<---------------cut here---------------start------------->8---
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)))
--8<---------------cut here---------------end--------------->8---

So it is part of Emacs 29.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: When was the function 'get-scratch-buffer-create' introduced?
  2022-12-12  5:26 When was the function 'get-scratch-buffer-create' introduced? Akib Azmain Turja
  2022-12-12  8:17 ` Philip Kaludercic
@ 2022-12-12  8:18 ` Stefan Kangas
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Kangas @ 2022-12-12  8:18 UTC (permalink / raw)
  To: Akib Azmain Turja, emacs-devel

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'.

We don't document every new function in NEWS, for example if it's not
important enough to be mentioned.

> When was this function introduced?

Just search the git log, and you will find it in commit
054062060e9f57fd037578378c23ad9ec294edac



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: When was the function 'get-scratch-buffer-create' introduced?
  2022-12-12  8:17 ` Philip Kaludercic
@ 2022-12-12 10:34   ` Akib Azmain Turja
  2022-12-12 19:51     ` Philip Kaludercic
  0 siblings, 1 reply; 5+ messages in thread
From: Akib Azmain Turja @ 2022-12-12 10:34 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2416 bytes --]

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!

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: When was the function 'get-scratch-buffer-create' introduced?
  2022-12-12 10:34   ` Akib Azmain Turja
@ 2022-12-12 19:51     ` Philip Kaludercic
  0 siblings, 0 replies; 5+ messages in thread
From: Philip Kaludercic @ 2022-12-12 19:51 UTC (permalink / raw)
  To: Akib Azmain Turja; +Cc: emacs-devel

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?



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-12-12 19:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12  5:26 When was the function 'get-scratch-buffer-create' introduced? Akib Azmain Turja
2022-12-12  8:17 ` Philip Kaludercic
2022-12-12 10:34   ` Akib Azmain Turja
2022-12-12 19:51     ` Philip Kaludercic
2022-12-12  8:18 ` Stefan Kangas

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.