Lars Ingebrigtsen <larsi@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 52508) by debbugs.gnu.org; 8 Sep 2022 14:17:11 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 08 10:17:11 2022 Received: from localhost ([127.0.0.1]:59694 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1oWIL9-0008R1-I6 for submit <at> debbugs.gnu.org; Thu, 08 Sep 2022 10:17:11 -0400 Received: from quimby.gnus.org ([95.216.78.240]:58624) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <larsi@HIDDEN>) id 1oWIL7-0008Qg-PX; Thu, 08 Sep 2022 10:17:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=eQ4L2CdcttzzFMUIWKW8qe14ksv/as5qUbLpjFXs1Y8=; b=PrmHbmcfVVPh7jfxNMgzI5ZsFO u1hsdOqwriec5213Jl/2A5ErIOEiruTAokKuIGvluPhQXX21caluk+ti+bJZFeH6w+HjSiM0d0a8d IOIBXjh8m2WftTooV0TYgAiHrzHdwMrtAEn6tox9Pl8KwC6xhQbe4lSVV8N9Na948fnw=; Received: from [84.212.220.105] (helo=joga) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <larsi@HIDDEN>) id 1oWIKy-0003Pn-QP; Thu, 08 Sep 2022 16:17:02 +0200 From: Lars Ingebrigtsen <larsi@HIDDEN> To: Dmitry Gutov <dgutov@HIDDEN> Subject: Re: bug#52508: [PATCH] Option for vc-delete-file to keep file on disk In-Reply-To: <a6cbfcab-1faf-a7db-905a-443bd31cce81@HIDDEN> (Dmitry Gutov's message of "Tue, 28 Dec 2021 02:53:19 +0200") References: <20211215095324.18195-1-ashwin@HIDDEN> <86a6h13j4i.fsf@HIDDEN> <85o85hsr3b.fsf@HIDDEN> <861r2dzqrj.fsf@HIDDEN> <85fsqt67y1.fsf@HIDDEN> <8535mt67k8.fsf@HIDDEN> <86k0g4a875.fsf@HIDDEN> <85czljcund.fsf@HIDDEN> <b20daeab-29b5-c116-4a43-52649374aab0@HIDDEN> <85h7av9xf8.fsf@HIDDEN> <85e94803-dd45-8223-a0b8-9ae3ca8e268b@HIDDEN> <85tuevjqg2.fsf@HIDDEN> <89a1cb96-80dc-bdc9-8f4f-409b0aa692c0@HIDDEN> <85ilvb8fj8.fsf@HIDDEN> <5fb80cff-2292-3a48-c789-5bedc8d1816c@HIDDEN> <85v8zay9il.fsf@HIDDEN> <a6cbfcab-1faf-a7db-905a-443bd31cce81@HIDDEN> X-Now-Playing: Blectum From Blechdom's _DeepBone_: "Noise About Boys (ft. Eugene S. Robinson)" Date: Thu, 08 Sep 2022 16:17:00 +0200 Message-ID: <87wnaex86b.fsf_-_@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Reading this bug report, it's unclear what the conclusion is. I agree that it would be useful to have a command to remove a file from the VC without deleting it. But I don't think the proposed impleme [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 52508 Cc: 52507 <at> debbugs.gnu.org, Ashwin Kafle <ashwin@HIDDEN>, 52508 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Reading this bug report, it's unclear what the conclusion is. I agree that it would be useful to have a command to remove a file from the VC without deleting it. But I don't think the proposed implementation is safe, because it only works with git -- and in other VCs, doing `C-u M-x vc-delete-file' would continue to delete the file, contrary to what the doc string says. Dmitry suggested to alter the interface, but that makes for awkward compatibility. Perhaps this should be a new command instead? That'd be less confusing, I think. `M-x vc-remove-file', for instance.
bug-gnu-emacs@HIDDEN
:bug#52508
; Package emacs
.
Full text available.Received: (at 52508) by debbugs.gnu.org; 20 Dec 2021 04:42:46 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 19 23:42:46 2021 Received: from localhost ([127.0.0.1]:48662 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mzAVa-0003S5-5T for submit <at> debbugs.gnu.org; Sun, 19 Dec 2021 23:42:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44880) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <rms@HIDDEN>) id 1mzAVY-0003Rs-7a for 52508 <at> debbugs.gnu.org; Sun, 19 Dec 2021 23:42:44 -0500 Received: from [2001:470:142:3::e] (port=57024 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <rms@HIDDEN>) id 1mzAVR-0005kK-E5; Sun, 19 Dec 2021 23:42:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=eAOzbi4cg0Eqk5niWQcMDZ4E33b23gBuqeta8UDXrgI=; b=iYCGbnynQlB5 LiVX2xHG8LTrZAU+tC1zT7wM9LinRDUw9+RTMct8LcDi9Kacm9weEIhXKBX7KsBB/XnLLmjTcFEo0 SHHrZz9IJO0YlQCbWxvOPQT9Ee9NCo40Wc1GL2DeOFw9Ueb3nlVtvO/FSMd4DNgm8DL33AN0xbpqQ C3Qb3lUOKOLyEWsMa3RkpGBlzQ9t3pdSSEu8Z6VTnRJfNUQfZ7tUtGREgKlPWUcJf1IzFpNq8dzpq 0+yruyBf1MddLImhTlVxdUKDS/Xg/fpkPzEEptwHG34XjXMaYwQyMCNnoJvQKMCw7GMXTuG53vgF0 58rnKjPBmuWm3qRfWTZyEg==; Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from <rms@HIDDEN>) id 1mzAVR-00052Y-HP; Sun, 19 Dec 2021 23:42:37 -0500 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman <rms@HIDDEN> To: Ashwin Kafle <ashwin@HIDDEN> In-Reply-To: <85r1aaqs96.fsf@HIDDEN> (message from Ashwin Kafle on Sat, 18 Dec 2021 07:36:21 +0000) Subject: Re: bug#52508: [PATCH] Option for vc-delete-file to keep file on disk References: <85bl1igo9d.fsf@HIDDEN> <E1myRX1-0001hI-D7@HIDDEN> <85r1aaqs96.fsf@HIDDEN> Message-Id: <E1mzAVR-00052Y-HP@HIDDEN> Date: Sun, 19 Dec 2021 23:42:37 -0500 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 52508 Cc: ashwin@HIDDEN, 52508 <at> debbugs.gnu.org, dgutov@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Reply-To: rms@HIDDEN Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > But, vc-delete-file is used by a lot of people and it's probably muscle > memory for them. I didn't want people to be affected much by this patch. I'm convinced. Happy hacking. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org)
bug-gnu-emacs@HIDDEN
:bug#52508
; Package emacs
.
Full text available.Received: (at 52508) by debbugs.gnu.org; 18 Dec 2021 07:35:31 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 18 02:35:31 2021 Received: from localhost ([127.0.0.1]:41192 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1myUFf-0000LA-9a for submit <at> debbugs.gnu.org; Sat, 18 Dec 2021 02:35:31 -0500 Received: from forward100j.mail.yandex.net ([5.45.198.240]:37042) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ashwin@HIDDEN>) id 1myUFb-0000Ku-7y for 52508 <at> debbugs.gnu.org; Sat, 18 Dec 2021 02:35:29 -0500 Received: from iva8-def7434e1e2c.qloud-c.yandex.net (iva8-def7434e1e2c.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:3b96:0:640:def7:434e]) by forward100j.mail.yandex.net (Yandex) with ESMTP id B8B1364F36D9; Sat, 18 Dec 2021 10:35:20 +0300 (MSK) Received: from iva4-b3ebd202b141.qloud-c.yandex.net (iva4-b3ebd202b141.qloud-c.yandex.net [2a02:6b8:c0c:4e8e:0:640:b3eb:d202]) by iva8-def7434e1e2c.qloud-c.yandex.net (mxback/Yandex) with ESMTP id 4YCHif4F0e-ZKeCdsmN; Sat, 18 Dec 2021 10:35:20 +0300 Authentication-Results: iva8-def7434e1e2c.qloud-c.yandex.net; dkim=pass Received: by iva4-b3ebd202b141.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id uj1bXzfhpW-ZJPWHCbn; Sat, 18 Dec 2021 10:35:19 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Yandex-Fwd: 2 From: Ashwin Kafle <ashwin@HIDDEN> To: Richard Stallman <rms@HIDDEN> Subject: Re: bug#52508: [PATCH] Option for vc-delete-file to keep file on disk References: <85bl1igo9d.fsf@HIDDEN> <E1myRX1-0001hI-D7@HIDDEN> Date: Sat, 18 Dec 2021 07:36:21 +0000 In-Reply-To: <E1myRX1-0001hI-D7@HIDDEN> (Richard Stallman's message of "Fri, 17 Dec 2021 23:41:15 -0500") Message-ID: <85r1aaqs96.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 52508 Cc: Ashwin Kafle <ashwin@HIDDEN>, 52508 <at> debbugs.gnu.org, dgutov@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Richard Stallman <rms@HIDDEN> writes: > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > > I've created the attached patch to have vc-delete file to keep files on > > disk using a prefix argument. I've only tested it for vc-git. > > This may seem shocking, but what about changing vc-delete-file > to ALWAYS preserve the local file? In other words, to change ONLY the repo? > > That's the operation that vc-delete-file is necessary for. > If you do in fact want to delete the local file as well, that's easy to do. > > This would have the advantage of one less switch to remember. I had the same initial thought ;) But, vc-delete-file is used by a lot of people and it's probably muscle memory for them. I didn't want people to be affected much by this patch. Also, there's a new revision of this patch under bug#52507 that will make sure that the local file is always preserved even if the VCS itself deletes it. After i understand what Juri is saying, i'll likely make a new patch removing the change from vc-git.el Thank you, Stallman, for all the hard work you've done and continue to do.
bug-gnu-emacs@HIDDEN
:bug#52508
; Package emacs
.
Full text available.Received: (at 52508) by debbugs.gnu.org; 18 Dec 2021 07:08:17 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 18 02:08:17 2021 Received: from localhost ([127.0.0.1]:41167 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1myTpI-00088b-NN for submit <at> debbugs.gnu.org; Sat, 18 Dec 2021 02:08:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54578) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1myTpE-00088M-W4 for 52508 <at> debbugs.gnu.org; Sat, 18 Dec 2021 02:08:15 -0500 Received: from [2001:470:142:3::e] (port=38370 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1myTp8-00077e-Fs; Sat, 18 Dec 2021 02:08: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=aUYVgHdYLT3HU5yb+vEZ9Ti3bTSmoDaQbz9GW70cQEE=; b=DQr8zebs5qDI TgkrXTHELOwe7sun6RYabSzF8JDY5cI3Yf6LZX1tGPFTA0+mhexpHLAo55K35I6d+sRZc1UOfC5kO +yDGfXyHRNh5QCcytOVW6Ep1a8HEMQl5P++yl2V5FIwqJzxF3ZRUTqRB+3NQBe28SoNQSuQlGrJAl Nu4aBBdj0Kztmnbnz61lEvs8HpbyYz71HtrQZktNtUfUmQt+Pyjvv2NuQNn/vz8bZBU31oSfdlsff NC2sGavgMEZfKpAe+appsI794NwHkagQcBHoL2rAaq9d3MXgZcwVv+itj+oeXZxDwPRqR65iFlywk Gi//bk35feDp++O8eHOVww==; Received: from [87.69.77.57] (port=1473 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1myTp7-0001qk-62; Sat, 18 Dec 2021 02:08:05 -0500 Date: Sat, 18 Dec 2021 09:07:53 +0200 Message-Id: <835yrmcrw6.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: rms@HIDDEN In-Reply-To: <E1myRX1-0001hI-D7@HIDDEN> (message from Richard Stallman on Fri, 17 Dec 2021 23:41:15 -0500) Subject: Re: bug#52508: [PATCH] Option for vc-delete-file to keep file on disk References: <85bl1igo9d.fsf@HIDDEN> <E1myRX1-0001hI-D7@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 52508 Cc: ashwin@HIDDEN, 52508 <at> debbugs.gnu.org, dgutov@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Richard Stallman <rms@HIDDEN> > Date: Fri, 17 Dec 2021 23:41:15 -0500 > Cc: ashwin@HIDDEN, 52508 <at> debbugs.gnu.org, dgutov@HIDDEN > > > I've created the attached patch to have vc-delete file to keep files on > > disk using a prefix argument. I've only tested it for vc-git. > > This may seem shocking, but what about changing vc-delete-file > to ALWAYS preserve the local file? In other words, to change ONLY the repo? I think it would be unexpected. VCS deletion usually means you delete both the file on the local disk and tell the VCS to delete it from the repository.
bug-gnu-emacs@HIDDEN
:bug#52508
; Package emacs
.
Full text available.Received: (at 52508) by debbugs.gnu.org; 18 Dec 2021 04:41:27 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 17 23:41:26 2021 Received: from localhost ([127.0.0.1]:41053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1myRXC-0004DH-8Y for submit <at> debbugs.gnu.org; Fri, 17 Dec 2021 23:41:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34292) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <rms@HIDDEN>) id 1myRX8-0004Cp-NQ for 52508 <at> debbugs.gnu.org; Fri, 17 Dec 2021 23:41:23 -0500 Received: from [2001:470:142:3::e] (port=34152 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <rms@HIDDEN>) id 1myRX1-0007u8-8f; Fri, 17 Dec 2021 23:41:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=wtUR60szDORhct0qSbJ0ORhWm0M7z0CsKamO/JOw2yk=; b=fEaDwy9vixi6 kc97vVksiMe975lFPI73MVqAQW2UT+UnVXd9SnTJUSDgzPo4n9UaS3hbZE+BUlLtY9szACGQeiNsb 5w5AJXe8JiWK7FDUtmYovhFV9PA2WViKieyJhAy6BdwjK9Z7CEkhQ/UaLQScgd6GNfrAc4NMfVG4W WdcnQQkZPeghafQyDoWAhBuVOOPdsW0fv3XlYM787M5zTO6JtDh22YjrYQZx0Icr0E6YbFfCoPcc2 A+u2gBWB50tWws4t2Xtwx7JWEk37H6b6iAR5tDufRR51JeRLj/XHieh2/HXZ4FblZ9qfs81LLtMAK lanikGp3a4MCGYKUNmvVkg==; Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from <rms@HIDDEN>) id 1myRX1-0001hI-D7; Fri, 17 Dec 2021 23:41:15 -0500 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman <rms@HIDDEN> To: Ashwin Kafle <ashwin@HIDDEN> In-Reply-To: <85bl1igo9d.fsf@HIDDEN> (message from Ashwin Kafle on Wed, 15 Dec 2021 10:23:42 +0000) Subject: Re: bug#52508: [PATCH] Option for vc-delete-file to keep file on disk References: <85bl1igo9d.fsf@HIDDEN> Message-Id: <E1myRX1-0001hI-D7@HIDDEN> Date: Fri, 17 Dec 2021 23:41:15 -0500 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 52508 Cc: ashwin@HIDDEN, 52508 <at> debbugs.gnu.org, dgutov@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Reply-To: rms@HIDDEN Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > I've created the attached patch to have vc-delete file to keep files on > disk using a prefix argument. I've only tested it for vc-git. This may seem shocking, but what about changing vc-delete-file to ALWAYS preserve the local file? In other words, to change ONLY the repo? That's the operation that vc-delete-file is necessary for. If you do in fact want to delete the local file as well, that's easy to do. This would have the advantage of one less switch to remember. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org)
bug-gnu-emacs@HIDDEN
:bug#52508
; Package emacs
.
Full text available.Received: (at 52508) by debbugs.gnu.org; 15 Dec 2021 18:06:38 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 15 13:06:38 2021 Received: from localhost ([127.0.0.1]:33644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mxYfl-0004xF-U8 for submit <at> debbugs.gnu.org; Wed, 15 Dec 2021 13:06:38 -0500 Received: from forward103j.mail.yandex.net ([5.45.198.246]:43546) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ashwin@HIDDEN>) id 1mxYfj-0004x0-J9 for 52508 <at> debbugs.gnu.org; Wed, 15 Dec 2021 13:06:36 -0500 Received: from iva8-1a0d05019375.qloud-c.yandex.net (iva8-1a0d05019375.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:108e:0:640:1a0d:501]) by forward103j.mail.yandex.net (Yandex) with ESMTP id C4C64100F43; Wed, 15 Dec 2021 21:06:28 +0300 (MSK) Received: from iva8-a4a480c9f089.qloud-c.yandex.net (iva8-a4a480c9f089.qloud-c.yandex.net [2a02:6b8:c0c:da5:0:640:a4a4:80c9]) by iva8-1a0d05019375.qloud-c.yandex.net (mxback/Yandex) with ESMTP id FsWaipvJSX-6SeKWiu2; Wed, 15 Dec 2021 21:06:28 +0300 Authentication-Results: iva8-1a0d05019375.qloud-c.yandex.net; dkim=pass Received: by iva8-a4a480c9f089.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id uIOjOUXCiQ-6RPOIu8X; Wed, 15 Dec 2021 21:06:27 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Yandex-Fwd: 2 From: Ashwin Kafle <ashwin@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#52508: [PATCH] Option for vc-delete-file to keep file on disk References: <85bl1igo9d.fsf@HIDDEN> <83sfuuhs5l.fsf@HIDDEN> Date: Wed, 15 Dec 2021 18:07:27 +0000 Message-ID: <854k79spwg.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 52508 Cc: Ashwin Kafle <ashwin@HIDDEN>, 52508 <at> debbugs.gnu.org, dgutov@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii <eliz@HIDDEN> writes: [...] >> I've created the attached patch to have vc-delete file to keep files on >> disk using a prefix argument. I've only tested it for vc-git. > > Thanks, sounds useful. > > A few minor comments below, mainly to the documentation parts: [...] Thanks, now fixed and attached. > >> - (let ((backup-inhibited nil)) >> + (let ((backup-inhibited nil) >> + ;; if you don't set this, then for some reason, the file is never >> brought back >> + (backup-by-copying t)) > > Wouldn't it be better to understand why this mystery happens? Yeah, a backup function should bring back the original file. That is indeed weird. But I can't read much elisp yet to be of help in here. In this case, backup-by-copying seems to be the better method for backups since the intention is to not touch the original files at all. Reading the docstring of backup-buffer, backup-by-rename doesn't look fit for this use case. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Option-for-vc-delete-file-to-keep-file-on-disk.patch From b8e5b8463f15a53e5fb6ddac5447005d4133606b Mon Sep 17 00:00:00 2001 From: Ashwin Kafle <ashwin@HIDDEN> Date: Wed, 15 Dec 2021 23:49:47 +0545 Subject: [PATCH] Option for vc-delete-file to keep file on disk Add a prefix argument on vc-delete-file to keep affected file on disk and keep the current buffer intact. This option relies on the backends to not delete files themselves. * doc/emacs/vc1-xtra.texi: Document the change. * lisp/vc/vc-git.el (vc-git-delete-file): Make git leave files on disk. * lisp/vc/vc.el (vc-delete-file): Change vc-delete-file to accept optional prefix argument. --- doc/emacs/vc1-xtra.texi | 3 ++- etc/NEWS | 4 ++++ lisp/vc/vc-git.el | 4 ++-- lisp/vc/vc.el | 18 ++++++++++++------ 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/doc/emacs/vc1-xtra.texi b/doc/emacs/vc1-xtra.texi index 4cd00cba6c..99e5eef7c1 100644 --- a/doc/emacs/vc1-xtra.texi +++ b/doc/emacs/vc1-xtra.texi @@ -122,7 +122,8 @@ VC Delete/Rename If you wish to delete a version-controlled file, use the command @kbd{M-x vc-delete-file}. This prompts for the file name, and deletes it via the version control system. The file is removed from the -working tree, and in the VC Directory buffer +working tree, and in the VC Directory buffer. If you give a prefix argument, +the file is not deleted from disk. @iftex (@pxref{VC Directory Mode,,, emacs, the Emacs Manual}), @end iftex diff --git a/etc/NEWS b/etc/NEWS index 8d83b2a7e3..af358aaedb 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -372,6 +372,10 @@ info node. This command only works for the Emacs and Emacs Lisp manuals. ** vc +*** 'C-x v x' accepts a prefix argument to keep file on disk. +Previously 'C-x v x' always deleted the selected file. Now if you give it +prefix argument, it will keep the buffer and file on disk intact. +Currently this is only implemented for vc-git. --- *** 'C-x v v' on an unregistered file will now use the most specific backend. Previously, if you had an SVN-covered "~/" directory, and a Git-covered diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 5c6a39aec9..69ef216529 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1569,8 +1569,8 @@ vc-git-next-revision (or (vc-git-symbolic-commit next-rev) next-rev))) (defun vc-git-delete-file (file) - (vc-git-command nil 0 (vc-git--literal-pathspec file) "rm" "-f" "--")) - + (vc-git-command nil 0 (vc-git--literal-pathspec file) "rm" "-f" "--cached" "--")) +) (defun vc-git-rename-file (old new) (vc-git-command nil 0 (list old new) "mv" "-f" "--")) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 64f752f248..a4d390fea8 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2970,14 +2970,17 @@ vc-transfer-file (vc-checkin file new-backend comment (stringp comment))))) ;;;###autoload -(defun vc-delete-file (file) +(defun vc-delete-file (file &optional keep-file) "Delete file and mark it as such in the version control system. If called interactively, read FILE, defaulting to the current -buffer's file name if it's under version control." +buffer's file name if it's under version control. +If a prefix argument is given (optional argument KEEP-FILE) then +don't delete the file from the disk." (interactive (list (read-file-name "VC delete file: " nil (when (vc-backend buffer-file-name) buffer-file-name) - t))) + t) + current-prefix-arg)) (setq file (expand-file-name file)) (let ((buf (get-file-buffer file)) (backend (vc-backend file))) @@ -2999,19 +3002,22 @@ vc-delete-file (unless (or (file-directory-p file) (null make-backup-files) (not (file-exists-p file))) (with-current-buffer (or buf (find-file-noselect file)) - (let ((backup-inhibited nil)) + (let ((backup-inhibited nil) + ;; If you don't set this, then for some reason, the file is never brought back. + (backup-by-copying t)) (backup-buffer)))) ;; Bind `default-directory' so that the command that the backend ;; runs to remove the file is invoked in the correct context. (let ((default-directory (file-name-directory file))) (vc-call-backend backend 'delete-file file)) ;; If the backend hasn't deleted the file itself, let's do it for him. - (when (file-exists-p file) (delete-file file)) + (when (and (file-exists-p file) (null keep-file)) + (delete-file file)) ;; Forget what VC knew about the file. (vc-file-clearprops file) ;; Make sure the buffer is deleted and the *vc-dir* buffers are ;; updated after this. - (vc-resynch-buffer file nil t))) + (vc-resynch-buffer file keep-file t))) ;;;###autoload (defun vc-rename-file (old new) -- 2.34.1 --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#52508
; Package emacs
.
Full text available.Juri Linkov <juri@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 52508) by debbugs.gnu.org; 15 Dec 2021 14:14:42 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 15 09:14:42 2021 Received: from localhost ([127.0.0.1]:60594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mxV3J-0002cu-JU for submit <at> debbugs.gnu.org; Wed, 15 Dec 2021 09:14:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46336) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1mxV3I-0002cg-GZ for 52508 <at> debbugs.gnu.org; Wed, 15 Dec 2021 09:14:40 -0500 Received: from [2001:470:142:3::e] (port=50660 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1mxV3C-0000CC-SC; Wed, 15 Dec 2021 09:14:34 -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=xyGxYEMk9OcuDY810qFs+s5ulhZYrPNVAjYaTGlcCDw=; b=IKNv2p5lbMOe t3PDBJqOX+/kQ7m9hp30knMen/z4sNUaebbwRw1xAm8/fg8q5gm+VPGkshgcF/j55GaRyN7K+LH6s HhKNpqolo9WqK6wO2oAaWJUot2JYhm0ccme3L9orxVoZFaG4AY7jEPblW294PuUhQ7MaesI/i5MTM 1JuSseovMK6eDa67DLlXP+fxwqrHhpsfCa7SnKOXB2vDyp9jy81SIbqdvZMD2fZtkxGGimsF784x1 KFfN/+erMnYgGZMW2blqpFGngt56DyCg717ERNXHaNqVkIfjx/91BSrXGvJdpuePHQ46+vRJFDCph pGdaYQBxAeWw8JH46ZMhyQ==; Received: from [87.69.77.57] (port=4989 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1mxV3C-0005L2-Mw; Wed, 15 Dec 2021 09:14:35 -0500 Date: Wed, 15 Dec 2021 16:14:14 +0200 Message-Id: <83sfuuhs5l.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Ashwin Kafle <ashwin@HIDDEN> In-Reply-To: <85bl1igo9d.fsf@HIDDEN> (message from Ashwin Kafle on Wed, 15 Dec 2021 10:23:42 +0000) Subject: Re: bug#52508: [PATCH] Option for vc-delete-file to keep file on disk References: <85bl1igo9d.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 52508 Cc: 52508 <at> debbugs.gnu.org, dgutov@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Ashwin Kafle <ashwin@HIDDEN> > Date: Wed, 15 Dec 2021 10:23:42 +0000 > Cc: Ashwin Kafle <ashwin@HIDDEN>, Dmitry Gutov <dgutov@HIDDEN> > > I've created the attached patch to have vc-delete file to keep files on > disk using a prefix argument. I've only tested it for vc-git. Thanks, sounds useful. A few minor comments below, mainly to the documentation parts: > * doc/emacs/vc1-xtra.texi: Document the change. > * lisp/vc/vc-git.el: Make git leave files on disk. > * lisp/vc/vc.el: Change vc-delete-file to accept optional prefix argument. Our conventions are to use the ChangeLog style of these entries, which means they should state the function names where the changes are made, not just the file names. > --- a/doc/emacs/vc1-xtra.texi > +++ b/doc/emacs/vc1-xtra.texi > @@ -122,7 +122,8 @@ VC Delete/Rename > If you wish to delete a version-controlled file, use the command > @kbd{M-x vc-delete-file}. This prompts for the file name, and deletes > it via the version control system. The file is removed from the > -working tree, and in the VC Directory buffer > +working tree, and in the VC Directory buffer. If you give a prefix argument, ^^ We leave 2 spaces between sentences, per US English conventions. > +*** 'C-x v x' accepts a prefix argument to keep file on disk Period at the end of the heading, please. > +Previously 'C-x v x' always deleted the selected file. Now if you give it > +prefix argument, it will keep the buffer and file on disk intact. Two spaces between sentences. > -(defun vc-delete-file (file) > +(defun vc-delete-file (file &optional keep-file) > "Delete file and mark it as such in the version control system. > If called interactively, read FILE, defaulting to the current > -buffer's file name if it's under version control." > - (interactive (list (read-file-name "VC delete file: " nil > - (when (vc-backend buffer-file-name) > - buffer-file-name) > - t))) > +buffer's file name if it's under version control. > +If a prefix argument is given (optional argument KEEP-FILE) then > +don't delete the file from the disk" Period missing at the end of the last sentence. > - (let ((backup-inhibited nil)) > + (let ((backup-inhibited nil) > + ;; if you don't set this, then for some reason, the file is never brought back > + (backup-by-copying t)) Wouldn't it be better to understand why this mystery happens? Also, please start the comment with a capital letter and end it with a period.
bug-gnu-emacs@HIDDEN
:bug#52508
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 15 Dec 2021 12:55:23 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 15 07:55:23 2021 Received: from localhost ([127.0.0.1]:60441 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mxToX-0006f1-GG for submit <at> debbugs.gnu.org; Wed, 15 Dec 2021 07:55:23 -0500 Received: from lists.gnu.org ([209.51.188.17]:54972) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ashwin@HIDDEN>) id 1mxRRD-0000Km-Ih for submit <at> debbugs.gnu.org; Wed, 15 Dec 2021 05:23:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ashwin@HIDDEN>) id 1mxRRD-0006Ra-An for bug-gnu-emacs@HIDDEN; Wed, 15 Dec 2021 05:23:07 -0500 Received: from forward100p.mail.yandex.net ([77.88.28.100]:50832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ashwin@HIDDEN>) id 1mxRR9-0005nt-K6 for bug-gnu-emacs@HIDDEN; Wed, 15 Dec 2021 05:23:06 -0500 Received: from myt4-644a0c5be03a.qloud-c.yandex.net (myt4-644a0c5be03a.qloud-c.yandex.net [IPv6:2a02:6b8:c12:7af:0:640:644a:c5b]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 8364A4F07F11 for <bug-gnu-emacs@HIDDEN>; Wed, 15 Dec 2021 13:22:43 +0300 (MSK) Received: from myt5-cceafa914410.qloud-c.yandex.net (myt5-cceafa914410.qloud-c.yandex.net [2a02:6b8:c12:3b23:0:640:ccea:fa91]) by myt4-644a0c5be03a.qloud-c.yandex.net (mxback/Yandex) with ESMTP id vZhN9SDlRN-MhfKJnYM; Wed, 15 Dec 2021 13:22:43 +0300 Authentication-Results: myt4-644a0c5be03a.qloud-c.yandex.net; dkim=pass Received: by myt5-cceafa914410.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 7CFz9qRr0R-MfPaxRh6; Wed, 15 Dec 2021 13:22:42 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Yandex-Fwd: 2 From: Ashwin Kafle <ashwin@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: [PATCH] Option for vc-delete-file to keep file on disk Date: Wed, 15 Dec 2021 10:23:42 +0000 Message-ID: <85bl1igo9d.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=77.88.28.100; envelope-from=ashwin@HIDDEN; helo=forward100p.mail.yandex.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 15 Dec 2021 07:55:18 -0500 Cc: Ashwin Kafle <ashwin@HIDDEN>, Dmitry Gutov <dgutov@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain Hello, I've created the attached patch to have vc-delete file to keep files on disk using a prefix argument. I've only tested it for vc-git. I've already signed the copyright papers. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Option-for-vc-delete-file-to-keep-file-on-disk.patch From 8bfbc34afa760c4d526fa15d8dddc78f2be78a81 Mon Sep 17 00:00:00 2001 From: Ashwin Kafle <ashwin@HIDDEN> Date: Wed, 15 Dec 2021 15:25:04 +0545 Subject: [PATCH] Option for vc-delete-file to keep file on disk Add a prefix argument on vc-delete-file to keep affected file on disk and keep the current buffer intact. This option relies on the backends to not delete files themselves. * doc/emacs/vc1-xtra.texi: Document the change. * lisp/vc/vc-git.el: Make git leave files on disk. * lisp/vc/vc.el: Change vc-delete-file to accept optional prefix argument. --- doc/emacs/vc1-xtra.texi | 3 ++- etc/NEWS | 4 ++++ lisp/vc/vc-git.el | 4 ++-- lisp/vc/vc.el | 20 +++++++++++--------- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/doc/emacs/vc1-xtra.texi b/doc/emacs/vc1-xtra.texi index 4cd00cba6c..2cf69583b3 100644 --- a/doc/emacs/vc1-xtra.texi +++ b/doc/emacs/vc1-xtra.texi @@ -122,7 +122,8 @@ VC Delete/Rename If you wish to delete a version-controlled file, use the command @kbd{M-x vc-delete-file}. This prompts for the file name, and deletes it via the version control system. The file is removed from the -working tree, and in the VC Directory buffer +working tree, and in the VC Directory buffer. If you give a prefix argument, +the file is not deleted from disk. @iftex (@pxref{VC Directory Mode,,, emacs, the Emacs Manual}), @end iftex diff --git a/etc/NEWS b/etc/NEWS index 8d83b2a7e3..2469060a3d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -372,6 +372,10 @@ info node. This command only works for the Emacs and Emacs Lisp manuals. ** vc +*** 'C-x v x' accepts a prefix argument to keep file on disk +Previously 'C-x v x' always deleted the selected file. Now if you give it +prefix argument, it will keep the buffer and file on disk intact. +Currently this is only implemented for vc-git. --- *** 'C-x v v' on an unregistered file will now use the most specific backend. Previously, if you had an SVN-covered "~/" directory, and a Git-covered diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 5c6a39aec9..69ef216529 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1569,8 +1569,8 @@ vc-git-next-revision (or (vc-git-symbolic-commit next-rev) next-rev))) (defun vc-git-delete-file (file) - (vc-git-command nil 0 (vc-git--literal-pathspec file) "rm" "-f" "--")) - + (vc-git-command nil 0 (vc-git--literal-pathspec file) "rm" "-f" "--cached" "--")) +) (defun vc-git-rename-file (old new) (vc-git-command nil 0 (list old new) "mv" "-f" "--")) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 64f752f248..43fc0e787e 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2970,14 +2970,13 @@ vc-transfer-file (vc-checkin file new-backend comment (stringp comment))))) ;;;###autoload -(defun vc-delete-file (file) +(defun vc-delete-file (file &optional keep-file) "Delete file and mark it as such in the version control system. If called interactively, read FILE, defaulting to the current -buffer's file name if it's under version control." - (interactive (list (read-file-name "VC delete file: " nil - (when (vc-backend buffer-file-name) - buffer-file-name) - t))) +buffer's file name if it's under version control. +If a prefix argument is given (optional argument KEEP-FILE) then +don't delete the file from the disk" + (interactive "f\nP") (setq file (expand-file-name file)) (let ((buf (get-file-buffer file)) (backend (vc-backend file))) @@ -2999,19 +2998,22 @@ vc-delete-file (unless (or (file-directory-p file) (null make-backup-files) (not (file-exists-p file))) (with-current-buffer (or buf (find-file-noselect file)) - (let ((backup-inhibited nil)) + (let ((backup-inhibited nil) + ;; if you don't set this, then for some reason, the file is never brought back + (backup-by-copying t)) (backup-buffer)))) ;; Bind `default-directory' so that the command that the backend ;; runs to remove the file is invoked in the correct context. (let ((default-directory (file-name-directory file))) (vc-call-backend backend 'delete-file file)) ;; If the backend hasn't deleted the file itself, let's do it for him. - (when (file-exists-p file) (delete-file file)) + (when (and (file-exists-p file) (null keep-file)) + (delete-file file)) ;; Forget what VC knew about the file. (vc-file-clearprops file) ;; Make sure the buffer is deleted and the *vc-dir* buffers are ;; updated after this. - (vc-resynch-buffer file nil t))) + (vc-resynch-buffer file keep-file t))) ;;;###autoload (defun vc-rename-file (old new) -- 2.34.1 --=-=-=--
Ashwin Kafle <ashwin@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#52508
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.