From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: When was the function 'get-scratch-buffer-create' introduced? Date: Mon, 12 Dec 2022 08:17:51 +0000 Message-ID: <87h6y1t4r4.fsf@posteo.net> References: <87zgbtb3ad.fsf@disroot.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27967"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Akib Azmain Turja Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 12 09:18:50 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p4e1R-00072o-Gy for ged-emacs-devel@m.gmane-mx.org; Mon, 12 Dec 2022 09:18:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p4e0a-0004Cn-IM; Mon, 12 Dec 2022 03:17:56 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p4e0Y-0004CY-5z for emacs-devel@gnu.org; Mon, 12 Dec 2022 03:17:54 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p4e0W-0007wh-4C for emacs-devel@gnu.org; Mon, 12 Dec 2022 03:17:53 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id DB173240029 for ; Mon, 12 Dec 2022 09:17:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1670833069; bh=ZQpl0y7Ynyg/XNDTvkHHFrfzp03gvX467ngbT5zz/1M=; h=From:To:Cc:Subject:Date:From; b=KHDLQbMtUDvn+IlXMu9E8K64Z6ddxv9RbqSO5L8WSkWIZbniVOtTzyCk9X55YCVyT DTLEoIFoQ5jzpfWpj5lnIYAX91quWXAZoqdKGjRtCA69Nu+LaP+JUCnh1mr2qhDqLM f9NyulPep7DYpI3nUMejHO8uHiOK6RvTdf2SI3VwkLxJ3areY/686uLmfqZLbqTtRD fXYAi0W4OoqyuqcL3Opo5a83gtD+/Y8pd9ulKb9uqYUfbN8fLjqA59uYEYOClwahXM jkfzp0MsiTAtKpxJtlUnKjVHecgF0ebDYv+rHMn1nPn1j4KgsapNUgGDKWvhY46V2R C9c7yTKXbOhVQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NVvd85GtKz6tmJ; Mon, 12 Dec 2022 09:17:48 +0100 (CET) In-Reply-To: <87zgbtb3ad.fsf@disroot.org> (Akib Azmain Turja's message of "Mon, 12 Dec 2022 11:26:50 +0600") Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:301193 Archived-At: 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: --8<---------------cut here---------------start------------->8--- 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))) --8<---------------cut here---------------end--------------->8--- So it is part of Emacs 29.