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 19:51:31 +0000 Message-ID: <871qp4tn7g.fsf@posteo.net> References: <87zgbtb3ad.fsf@disroot.org> <87h6y1t4r4.fsf@posteo.net> <87zgbs7vxg.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="3940"; 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 20:52:20 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 1p4oqZ-0000p3-RA for ged-emacs-devel@m.gmane-mx.org; Mon, 12 Dec 2022 20:52:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p4opt-0007Si-Aj; Mon, 12 Dec 2022 14:51:37 -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 1p4opr-0007SN-3R for emacs-devel@gnu.org; Mon, 12 Dec 2022 14:51:35 -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 1p4opo-0000yZ-Ss for emacs-devel@gnu.org; Mon, 12 Dec 2022 14:51:34 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id BE8D2240027 for ; Mon, 12 Dec 2022 20:51:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1670874689; bh=XFHdx6jsxKbiNOso89DDm8ggQMYjG/TCm94Q74r5U7c=; h=From:To:Cc:Subject:Date:From; b=E3X/mA9JmLGLur6jdpINBDFB9BTZllyl0RS77BLaSpJoQDFcbmRu4R1eqCRvjfRN0 80XvbYuT91uWyR4KOGhUj/uBPNQKu34SSqRVsbAW9FhRCIQdrarIKo7jLYpfdRRO46 4h5WYBFdjzh6kZGKXXlqhF1TNtaCnmZemuMnlzXb/6ITdEomAQrBWVa+0nhfPyGhXp 4nxG9yKd1xrjW7o5fYOIclJX6N/iblJ1OjqY3s5z4wglneGFF8nMw7XeHAwfxS3Pwh bta5zHVSuZe8t9ZYDmgOhzuNJTHYvACjnqb4KWF1yrz1Gqmpeu808z9DM6Rd/6ajP+ UeLZAYLrlrH7Q== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NWC1Y1jk8z6tqj; Mon, 12 Dec 2022 20:51:29 +0100 (CET) In-Reply-To: <87zgbs7vxg.fsf@disroot.org> (Akib Azmain Turja's message of "Mon, 12 Dec 2022 16:34:03 +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:301277 Archived-At: Akib Azmain Turja writes: > 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! What are you using the function for? Would it make sense adding it to Compat?