From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#67313: [PATCH] New command write-file-no-switch Date: Tue, 21 Nov 2023 13:26:49 +0200 Message-ID: <83h6lfibye.fsf@gnu.org> References: <87zfz8dmk5.fsf@jeremybryant.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21381"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67313@debbugs.gnu.org To: Jeremy Bryant Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 21 12:28:12 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1r5OvL-0005O7-Tp for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Nov 2023 12:28:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5OvD-0002Fk-NI; Tue, 21 Nov 2023 06:28:03 -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 1r5OvA-0002BT-Vq for bug-gnu-emacs@gnu.org; Tue, 21 Nov 2023 06:28:01 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5Ov9-0006U1-9Y for bug-gnu-emacs@gnu.org; Tue, 21 Nov 2023 06:27:59 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r5OvB-0005GC-K8 for bug-gnu-emacs@gnu.org; Tue, 21 Nov 2023 06:28:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Nov 2023 11:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67313 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 67313-submit@debbugs.gnu.org id=B67313.170056604020166 (code B ref 67313); Tue, 21 Nov 2023 11:28:01 +0000 Original-Received: (at 67313) by debbugs.gnu.org; 21 Nov 2023 11:27:20 +0000 Original-Received: from localhost ([127.0.0.1]:55267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r5OuV-0005FC-KF for submit@debbugs.gnu.org; Tue, 21 Nov 2023 06:27:19 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58380) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r5OuR-0005Ex-0f for 67313@debbugs.gnu.org; Tue, 21 Nov 2023 06:27:18 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5OuI-0006L0-Cr; Tue, 21 Nov 2023 06:27:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=L8J/Z03nGIFfZCBeNFFO5BrhI7e6TkcA5s7RsoHaN7w=; b=fHyX7OnmV3q7 gE4kLPonc5AIOnIDAmf6CH/e3FLzLnjOiQC0rPtPaUYHASHYHRyG+b+vkH1JTZ9eHLupMRM++aJYg twJYhPo1zRlmA4MM3+tv+8ki8DRyu+VVyCPVLvqdJgJgE/WSaVKFzi+LgVnwi40AzzKHee0cTNHrc OvC9s4+oJwZsaPnY2ofe5foMG1C9JFEJThBiMvGnST51jGnk+xvEsKGeFxity68gpKitibOoWDtpO 6QWb+pKOsEZA1ZwknRv1CmpigbZ6OlInk5eIpRmGPmiPvzL8qTDWFRvJt2Wbj2xOnOSTZzHG+KwBI gCRkIucyMPSdtITTp6ovtQ==; In-Reply-To: <87zfz8dmk5.fsf@jeremybryant.net> (bug-gnu-emacs@gnu.org) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:274711 Archived-At: > Date: Mon, 20 Nov 2023 23:33:27 +0000 > From: Jeremy Bryant via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > By default write-file changes the buffer to point to the new filename, > but a user may wish to simply do the equivalent of write-file without > switching, as a sort of backup file. > > The attached is a patch concept to introduce the idea. Please let me > know if this makes sense to introduce a new command rather than > modifying the existing one (which may be less convenient). I understand > there would be additional things to do for new commands, but would like > to propose the idea first. Any suggestions welcome. Why is it not enough to be able to use "M-x write-region"? In any case, a new command is definitely overkill, IMO. > + (copy-file buffer-file-name filename) This doesn't write the buffer to the file, it copies the file visited by the buffer to the new file. So if the buffer has unsaved edits, they will not be written, unlike what write-file does. Also, what if this command is invoked from a buffer that doesn't visit any file, and thus buffer-file-name is nil? Thanks.