GNU bug report logs - #52507
[PATCH] Option for vc-delete-file to keep file on disk

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Ashwin Kafle <ashwin@HIDDEN>; Keywords: patch; merged with #52508; dated Wed, 15 Dec 2021 12:56:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 26 Dec 2021 17:46:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 26 12:46:12 2021
Received: from localhost ([127.0.0.1]:41475 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1n1Xb2-0004sw-0I
	for submit <at> debbugs.gnu.org; Sun, 26 Dec 2021 12:46:12 -0500
Received: from relay5-d.mail.gandi.net ([217.70.183.197]:49653)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1n1Xay-0004rp-44
 for 52507 <at> debbugs.gnu.org; Sun, 26 Dec 2021 12:46:09 -0500
Received: (Authenticated sender: juri@HIDDEN)
 by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 8FD9A1C0002;
 Sun, 26 Dec 2021 17:46:00 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Ashwin Kafle <ashwin@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
Organization: LINKOV.NET
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>
Date: Sun, 26 Dec 2021 19:41:37 +0200
In-Reply-To: <85czljcund.fsf@HIDDEN> (Ashwin Kafle's message of "Sun, 
 26 Dec 2021 14:23:18 +0000")
Message-ID: <865yrbz5sm.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org
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.7 (-)

> Say you use the current vc-delete-file and then immediately restore it
> from backup (before commiting).  VC will show the file as unregistered.
> I think this behavior of vc should be fixed instead.

Indeed, often vc causes such a state that requires to resort to
git commands like `git restore`, so vc should be improved in this regard.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 26 Dec 2021 17:46:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 26 12:46:12 2021
Received: from localhost ([127.0.0.1]:41473 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1n1Xb1-0004su-Ns
	for submit <at> debbugs.gnu.org; Sun, 26 Dec 2021 12:46:11 -0500
Received: from relay1-d.mail.gandi.net ([217.70.183.193]:41777)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1n1Xau-0004rS-R9
 for 52507 <at> debbugs.gnu.org; Sun, 26 Dec 2021 12:46:09 -0500
Received: (Authenticated sender: juri@HIDDEN)
 by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 6F58E240006;
 Sun, 26 Dec 2021 17:45:56 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
Organization: LINKOV.NET
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <86a6h13j4i.fsf@HIDDEN> <85o85hsr3b.fsf@HIDDEN>
 <861r2dzqrj.fsf@HIDDEN> <85fsqt67y1.fsf@HIDDEN>
 <8535mt67k8.fsf@HIDDEN> <86k0g4a875.fsf@HIDDEN>
 <f6dc58c6-3139-0dd4-f695-a6162fffe906@HIDDEN>
 <86ilvfba32.fsf@HIDDEN>
 <49062cc5-64e2-3214-4e8f-bc496b04e15e@HIDDEN>
Date: Sun, 26 Dec 2021 19:43:20 +0200
In-Reply-To: <49062cc5-64e2-3214-4e8f-bc496b04e15e@HIDDEN> (Dmitry Gutov's
 message of "Fri, 24 Dec 2021 02:48:01 +0200")
Message-ID: <86k0frz66d.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org, Ashwin Kafle <ashwin@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.7 (-)

>> I doubt that anyone might want to commit the file deletion immediately,
>> because file deletions usually are committed together with other changes.
>
> Right. That's why I suggested either to have a buffer-local var to store
> the "to be deleted" status, or do that in the staging area first.
>
>> But maybe git has a way to mark a file as deleted without actually deleting it?
>> So `git status --porcelain -z --untracked-files` could return "D" for such file
>> that still exists, this would be the simplest solution.
>
> 'git rm --cached', used in the patch for this issue originally, is indeed
> such command. Unless I misunderstood the question.
>
> $ git rm --cached CONTRIBUTE
> rm 'CONTRIBUTE'                                   $ git status --porcelain
> --untracked-files
> D  CONTRIBUTE
> ?? CONTRIBUTE

Both "D " and "??" correspond to the 'unregistered' status in vc-dir
according to 'vc-git--git-status-to-vc-state':

  (defun vc-git--git-status-to-vc-state (code-list)
      ...
      ('("D " "??") 'unregistered)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 26 Dec 2021 17:02:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 26 12:02:27 2021
Received: from localhost ([127.0.0.1]:41413 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1n1Wuh-0003WW-N0
	for submit <at> debbugs.gnu.org; Sun, 26 Dec 2021 12:02:27 -0500
Received: from forward108p.mail.yandex.net ([77.88.28.116]:38148)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ashwin@HIDDEN>) id 1n1Wuf-0003WE-Bh
 for 52507 <at> debbugs.gnu.org; Sun, 26 Dec 2021 12:02:26 -0500
Received: from iva8-82124814dfe8.qloud-c.yandex.net
 (iva8-82124814dfe8.qloud-c.yandex.net
 [IPv6:2a02:6b8:c0c:792d:0:640:8212:4814])
 by forward108p.mail.yandex.net (Yandex) with ESMTP id CC7A72674FA2;
 Sun, 26 Dec 2021 20:02:17 +0300 (MSK)
Received: from iva6-2d18925256a6.qloud-c.yandex.net
 (iva6-2d18925256a6.qloud-c.yandex.net [2a02:6b8:c0c:7594:0:640:2d18:9252])
 by iva8-82124814dfe8.qloud-c.yandex.net (mxback/Yandex) with ESMTP id
 qlKGgZnlfr-2He8j13N; Sun, 26 Dec 2021 20:02:17 +0300
Authentication-Results: iva8-82124814dfe8.qloud-c.yandex.net; dkim=pass
Received: by iva6-2d18925256a6.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA
 id 9RJiZWpBsZ-2FPuq86x; Sun, 26 Dec 2021 20:02:16 +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: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
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>
Date: Sun, 26 Dec 2021 17:03:23 +0000
In-Reply-To: <89a1cb96-80dc-bdc9-8f4f-409b0aa692c0@HIDDEN> (Dmitry Gutov's
 message of "Sun, 26 Dec 2021 18:28:28 +0200")
Message-ID: <85ilvb8fj8.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.7 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org, Ashwin Kafle <ashwin@HIDDEN>,
 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: -1.7 (-)

Dmitry Gutov <dgutov@HIDDEN> writes:

> On 26.12.2021 19:12, Ashwin Kafle wrote:
>>> All right.
>>>
>>> Well, it seems like it will add more cognitive load in the "common"
>>> scenario -- where you end up deleting the file you said you want to
>>> delete.
>>>
>>> And it will be a breaking change in the existing behavior/UI.
>> If you delete from disk it behaves exactly like how it's doing right
>> now.  The only difference should be when you delete and immediately
>> restore from backup and in that case, only vc-dir shows one extra file.
>> I don't think it brakes any existing behavior.
>
> But the file would stay around, right? That would be different.

Only if you give vc-delete-file a prefix argument, otherwise it'll be
exactly the same.  It will delete even if we use git rm --cached (because
it is checked later if the file exists anymore or not)

>
> And I was referring to the VC-Dir interface which would show new
> elements (additional entries for some files).

Only if the file is deleted in the index and has not been commited yet.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 26 Dec 2021 16:29:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 26 11:29:47 2021
Received: from localhost ([127.0.0.1]:41374 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1n1WP5-0002TH-Mz
	for submit <at> debbugs.gnu.org; Sun, 26 Dec 2021 11:29:47 -0500
Received: from mail-wm1-f43.google.com ([209.85.128.43]:44736)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1n1WP3-0002T0-Rp
 for 52507 <at> debbugs.gnu.org; Sun, 26 Dec 2021 11:29:46 -0500
Received: by mail-wm1-f43.google.com with SMTP id
 f134-20020a1c1f8c000000b00345c05bc12dso7212314wmf.3
 for <52507 <at> debbugs.gnu.org>; Sun, 26 Dec 2021 08:29:45 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=poJAnMyAnXeiODMBY5OLk/Zy7SngwAg2Rm5QoNhduUg=;
 b=fDxP/csiLMQ71WFZsQC8ym2n4S6BFeTIN6HjY8d2pAWVvYcPHlPp77av21vmIpqy8Y
 ZKVciU23EHJFwZBC55cHm992miF8g+TD09B53y75s1Cf/d2LrUbys+Hf3wLGVT2TTBp4
 x65u4JjkBae++oFeCMXl6hZAefNEbov1G3JHbK4zGTjGNOFk7fULbtuzwcMhOkaA/G+h
 3g88VOns+toinGHBjyTgaudQSu0oKRmRlHcNatAMPxV5BOJfLHgeR4Q53DdxwoXx0o6q
 rEpQbZyfG2K7KouS4JWuo7ALDPNoVAyik0RsiIeBiHGTpfW+rr/KWcu3TRHPI3fqWcDP
 3XZA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=poJAnMyAnXeiODMBY5OLk/Zy7SngwAg2Rm5QoNhduUg=;
 b=DBYEzpRHNaWzdfFOApk+CFIgtbzqpmrGagbnwcQ4NEtIOAIYaSpxxM/JsrW5PjCmSi
 pwNg3mFYtpKJVSYCzEkCOrt9VSSNipQBXjRkFF3Qmz3vN6zzazNjOP2PM5Pr8k6u/F9F
 Zeww8d3LTLmemVunXJVIsEuMzWMSN0k1t3xu8zRzQcD5sNHHRw1bzM4Inwhx69ye1LAI
 BvPaTTjW/GIbMV8eXMMb90AUX22sEirtGXxTe7LjBhCSdcmGC+HJmn0XHyepSUoPrsW1
 0h5SjB8a8/k9mVtN8zah77VHUnc9jrjl1DDH29x27myTPD3ZTzJbC1c3+fpEJzIm0qx0
 pIiw==
X-Gm-Message-State: AOAM531jiHt6v2VwMcCwHHVDfkGgFUjTulq2FZ9y7V4iyRq7VECBGnph
 xxfOsDX7Q3SeBs8zxPykAJs=
X-Google-Smtp-Source: ABdhPJyaG+UXIS1tkehjs1bVIyZpv2JjpHLPu1n3rshrt9hWMl8IraNFKD6KHqO7qaHdaLQ4e122XA==
X-Received: by 2002:a1c:ed07:: with SMTP id l7mr10670483wmh.12.1640536180052; 
 Sun, 26 Dec 2021 08:29:40 -0800 (PST)
Received: from [192.168.0.6] ([46.251.119.176])
 by smtp.googlemail.com with ESMTPSA id u14sm13012728wrf.39.2021.12.26.08.29.39
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sun, 26 Dec 2021 08:29:39 -0800 (PST)
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
To: Ashwin Kafle <ashwin@HIDDEN>
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>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <89a1cb96-80dc-bdc9-8f4f-409b0aa692c0@HIDDEN>
Date: Sun, 26 Dec 2021 18:28:28 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <85tuevjqg2.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.4 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <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: -0.6 (/)

On 26.12.2021 19:12, Ashwin Kafle wrote:
>> All right.
>>
>> Well, it seems like it will add more cognitive load in the "common"
>> scenario -- where you end up deleting the file you said you want to
>> delete.
>>
>> And it will be a breaking change in the existing behavior/UI.
> If you delete from disk it behaves exactly like how it's doing right
> now.  The only difference should be when you delete and immediately
> restore from backup and in that case, only vc-dir shows one extra file.
> I don't think it brakes any existing behavior.

But the file would stay around, right? That would be different.

And I was referring to the VC-Dir interface which would show new 
elements (additional entries for some files).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 26 Dec 2021 16:11:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 26 11:11:16 2021
Received: from localhost ([127.0.0.1]:41344 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1n1W7A-0001vW-EO
	for submit <at> debbugs.gnu.org; Sun, 26 Dec 2021 11:11:16 -0500
Received: from forward108o.mail.yandex.net ([37.140.190.206]:55804)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ashwin@HIDDEN>) id 1n1W78-0001vF-OQ
 for 52507 <at> debbugs.gnu.org; Sun, 26 Dec 2021 11:11:16 -0500
Received: from myt6-06c5907de372.qloud-c.yandex.net
 (myt6-06c5907de372.qloud-c.yandex.net
 [IPv6:2a02:6b8:c12:42ad:0:640:6c5:907d])
 by forward108o.mail.yandex.net (Yandex) with ESMTP id 428375DD115D;
 Sun, 26 Dec 2021 19:11:07 +0300 (MSK)
Received: from myt6-ad03e4543bb0.qloud-c.yandex.net
 (myt6-ad03e4543bb0.qloud-c.yandex.net [2a02:6b8:c12:422d:0:640:ad03:e454])
 by myt6-06c5907de372.qloud-c.yandex.net (mxback/Yandex) with ESMTP id
 w8CY1POEal-B6eimDFn; Sun, 26 Dec 2021 19:11:07 +0300
Authentication-Results: myt6-06c5907de372.qloud-c.yandex.net; dkim=pass
Received: by myt6-ad03e4543bb0.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA
 id Qxgw6KHqcY-B5Pm1K7B; Sun, 26 Dec 2021 19:11:05 +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: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
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>
Date: Sun, 26 Dec 2021 16:12:13 +0000
In-Reply-To: <85e94803-dd45-8223-a0b8-9ae3ca8e268b@HIDDEN> (Dmitry Gutov's
 message of "Sun, 26 Dec 2021 17:57:07 +0200")
Message-ID: <85tuevjqg2.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: 52507
Cc: 52507 <at> debbugs.gnu.org, Ashwin Kafle <ashwin@HIDDEN>,
 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: -1.0 (-)

Dmitry Gutov <dgutov@HIDDEN> writes:

> On 26.12.2021 18:51, Ashwin Kafle wrote:
>> Dmitry Gutov<dgutov@HIDDEN>  writes:
>> 
>>> On 26.12.2021 17:23, Ashwin Kafle wrote:
>>>> Say you use the current vc-delete-file and then immediately restore it
>>>> from backup (before commiting).  VC will show the file as unregistered.
>>>> I think this behavior of vc should be fixed instead.
>>> What would you have it do instead?
>> I think a better way would be to show two files in vc-dir one saying
>> unregistered and one saying deleted.  You mark the one saying deleted
>> then commit that fileset which will not be present after being commited.
>
> All right.
>
> Well, it seems like it will add more cognitive load in the "common"
> scenario -- where you end up deleting the file you said you want to
> delete.
>
> And it will be a breaking change in the existing behavior/UI.

If you delete from disk it behaves exactly like how it's doing right
now.  The only difference should be when you delete and immediately
restore from backup and in that case, only vc-dir shows one extra file.
I don't think it brakes any existing behavior.


>
>> That mechanism can also be used for git add -p as you can show staged
>> file and unsatged file separately.
>
> Perhaps it we added a different UI for staging and committing from
> staging area (like in Magit), it could both be presented better and
> avoid bothering the existing users who like the simpler workflow.

Yeah, it's probably a bit tricky for partial adds but for complete file
deletions it should be no different at all.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 26 Dec 2021 15:58:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 26 10:58:27 2021
Received: from localhost ([127.0.0.1]:41335 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1n1Vul-0001Y0-HS
	for submit <at> debbugs.gnu.org; Sun, 26 Dec 2021 10:58:27 -0500
Received: from mail-wr1-f48.google.com ([209.85.221.48]:35379)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1n1Vuj-0001Xd-Nm
 for 52507 <at> debbugs.gnu.org; Sun, 26 Dec 2021 10:58:27 -0500
Received: by mail-wr1-f48.google.com with SMTP id j18so27602014wrd.2
 for <52507 <at> debbugs.gnu.org>; Sun, 26 Dec 2021 07:58:25 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=Hn06Cz0/6OfrfzUSnbVXqf5Spmy7aeZxHJSME3oBjVw=;
 b=TtPNXQy0wFNg6gphUeU9NSGskcyeklzYlXXtpyvrzCEIBGx/7na/wSJCfu6tENPk4W
 OI33hKHhT8bsKRrBrrGIf3A2Nj/dETaJpUPg8Ny7isN2mezMyvxuon6UEMZFaLg5oPVx
 va2I6ltZdx+rKk/5wNM0ESLVyJVPK8NGEBjM9mpFfclRqDxL4F1JE0CbBqk7oaKlGhn2
 5SIJcaPR3hHQlNpfoRd96+sXsqXfoyHNUxEQ57SO0+OQkj/cNQOCA5/1/hrtHnyb7jr6
 FoLCXmFIbjjopUwrldQzDb15MpzYHG+CDOdsiIqFrHEu6+QnpF99WsUKINTnKcZurGNE
 mvCg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=Hn06Cz0/6OfrfzUSnbVXqf5Spmy7aeZxHJSME3oBjVw=;
 b=4HwVEcspkbwkb9l6BAJwDOawzRywyndsRZ2xlCaOCBlyL/xf5jffihjbd+u5HuhIf9
 FHnSePHWl576unHctNTgYdtkhvwFfF5F537+KteH6eZr2RQv42CijvQtpnIpdVLBLeRR
 cZFRXKDAoAOPBkaxtuenIu5aQNWybQTVZYpbZ8daXRAHXT1WcAQtkKeKiolVhdAZVcUG
 Uc3Lwiz7ev0L+RZ3dyrp2l2lPGQ8L5IcvX+onzYKCSHQLN5WyFFQMiUuch3fbJVH1bpa
 LdxT5/ZvqhVNgrCAsCPIsD5uEJNBvX5SNTLD2/8uYuEUqADfXnU8Hw9HzJxL1wk8LbET
 i7Sg==
X-Gm-Message-State: AOAM5330xP/sMBECmNPpds53OGKLxsSRFBxCEux1TiyMUHhzfhHMlf/o
 wB7JfywzvGw0slvo2j8kq/o=
X-Google-Smtp-Source: ABdhPJwyYnKp8vFpQHRQ5+PH/s27ThqXQXd170+sX31gY57HaOAKWT+CElD+sJddsMMcDGX+8Un+lQ==
X-Received: by 2002:adf:f7d2:: with SMTP id a18mr10340806wrq.354.1640534299629; 
 Sun, 26 Dec 2021 07:58:19 -0800 (PST)
Received: from [192.168.0.6] ([46.251.119.176])
 by smtp.googlemail.com with ESMTPSA id j39sm10718614wms.0.2021.12.26.07.58.18
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sun, 26 Dec 2021 07:58:19 -0800 (PST)
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
To: Ashwin Kafle <ashwin@HIDDEN>
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>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <85e94803-dd45-8223-a0b8-9ae3ca8e268b@HIDDEN>
Date: Sun, 26 Dec 2021 17:57:07 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <85h7av9xf8.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.4 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <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: -0.6 (/)

On 26.12.2021 18:51, Ashwin Kafle wrote:
> Dmitry Gutov<dgutov@HIDDEN>  writes:
> 
>> On 26.12.2021 17:23, Ashwin Kafle wrote:
>>> Say you use the current vc-delete-file and then immediately restore it
>>> from backup (before commiting).  VC will show the file as unregistered.
>>> I think this behavior of vc should be fixed instead.
>> What would you have it do instead?
> I think a better way would be to show two files in vc-dir one saying
> unregistered and one saying deleted.  You mark the one saying deleted
> then commit that fileset which will not be present after being commited.

All right.

Well, it seems like it will add more cognitive load in the "common" 
scenario -- where you end up deleting the file you said you want to delete.

And it will be a breaking change in the existing behavior/UI.

> That mechanism can also be used for git add -p as you can show staged
> file and unsatged file separately.

Perhaps it we added a different UI for staging and committing from 
staging area (like in Magit), it could both be presented better and 
avoid bothering the existing users who like the simpler workflow.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 26 Dec 2021 15:50:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 26 10:50:42 2021
Received: from localhost ([127.0.0.1]:41331 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1n1VnG-0001L6-Nr
	for submit <at> debbugs.gnu.org; Sun, 26 Dec 2021 10:50:42 -0500
Received: from forward100p.mail.yandex.net ([77.88.28.100]:51080)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ashwin@HIDDEN>) id 1n1VnD-0001Kl-KR
 for 52507 <at> debbugs.gnu.org; Sun, 26 Dec 2021 10:50:41 -0500
Received: from iva6-6951b41b66a9.qloud-c.yandex.net
 (iva6-6951b41b66a9.qloud-c.yandex.net
 [IPv6:2a02:6b8:c0c:610b:0:640:6951:b41b])
 by forward100p.mail.yandex.net (Yandex) with ESMTP id 18FB44F07BEA;
 Sun, 26 Dec 2021 18:50:32 +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 iva6-6951b41b66a9.qloud-c.yandex.net (mxback/Yandex) with ESMTP id
 rISHElly2o-oVf0qnit; Sun, 26 Dec 2021 18:50:32 +0300
Authentication-Results: iva6-6951b41b66a9.qloud-c.yandex.net; dkim=pass
Received: by iva8-a4a480c9f089.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA
 id QTuLo63dEE-oTQax0N8; Sun, 26 Dec 2021 18:50:29 +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: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
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>
Date: Sun, 26 Dec 2021 15:51:39 +0000
In-Reply-To: <b20daeab-29b5-c116-4a43-52649374aab0@HIDDEN> (Dmitry Gutov's
 message of "Sun, 26 Dec 2021 17:38:22 +0200")
Message-ID: <85h7av9xf8.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: 52507
Cc: 52507 <at> debbugs.gnu.org, Ashwin Kafle <ashwin@HIDDEN>,
 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: -1.0 (-)

Dmitry Gutov <dgutov@HIDDEN> writes:

> On 26.12.2021 17:23, Ashwin Kafle wrote:
>> Say you use the current vc-delete-file and then immediately restore it
>> from backup (before commiting).  VC will show the file as unregistered.
>> I think this behavior of vc should be fixed instead.
>
> What would you have it do instead?

I think a better way would be to show two files in vc-dir one saying
unregistered and one saying deleted.  You mark the one saying deleted
then commit that fileset which will not be present after being commited.

That mechanism can also be used for git add -p as you can show staged
file and unsatged file separately. 




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 26 Dec 2021 15:39:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 26 10:39:40 2021
Received: from localhost ([127.0.0.1]:41327 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1n1Vca-0000zm-OC
	for submit <at> debbugs.gnu.org; Sun, 26 Dec 2021 10:39:40 -0500
Received: from mail-wr1-f49.google.com ([209.85.221.49]:34740)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1n1VcY-0000zX-TX
 for 52507 <at> debbugs.gnu.org; Sun, 26 Dec 2021 10:39:39 -0500
Received: by mail-wr1-f49.google.com with SMTP id s1so27585454wrg.1
 for <52507 <at> debbugs.gnu.org>; Sun, 26 Dec 2021 07:39:38 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=VRsEIb5AxbEq4/yr11kSzpz9pYL0BQcrkmOtHaVW/p4=;
 b=mKraOfdwmOZh4aZcPylg9brk9G6MeYxsJI2OXNQ/wlgzGagyYPDXWoc1rYdO6AfMOr
 Lp9mTy3APS7BXjMkg2WscBxKW6jgOTHX7eZVeYJ1pB4X2/lgl+l8BWysQGbSIRUtqqcy
 x8Ei9nbvzntgVlR6bb83hqxTd0yat6lCkOgxEHOXW+Dv+BPKJ1wVk7fs2P3GqWk2sqDf
 xc17Fb2cl9LzPFMyC6/U4YXNNqVNwmCmbhyzgP49tbt2LrAsn9ieN6d4/ScpnYihSdX+
 NRIoxpSRVff6yOQXxigFSQ4y5H3+mywYJ/tTf7nxHcizckD1rNzYmPoK0F3TO0dyC3eM
 uzMA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=VRsEIb5AxbEq4/yr11kSzpz9pYL0BQcrkmOtHaVW/p4=;
 b=CyN7jue0sDZeXTDSo4ZiGzTsNLImaAvR3iC4QQ/GHL7NtqjpCad7EvMTHW8AfaZqe/
 j3iGzqzscNlqf44cq+FXHgJ53J2qrYB7hZtDCHXB4KEIxzVItish/Ld7GOQg2r9rniqG
 C+X29j1ICukRIKXu+UDxSs6kA66pyM4zjmCrD41vbjhp81ualKaBzz0unNJ9snfo+V3t
 NIQy4mGivOjW3krIqTIP6ZZody3CoWBWN/wNKSt0VwiKEDS0f9webdtpcVpqt7JkYGP1
 zZcjEY9MrlBpUAfvMZ8AYiktGbE68Yrtrc350Srkww43kY6XE11ZRWHE7yUK6984WNA7
 bG4Q==
X-Gm-Message-State: AOAM531DmR1WjsyzoIkWZVwS4RuuZ9pb22eAiNH3gawWsy8OFhIAUqg/
 GC6tsMdbEH/oHLiuZXg8LuTvKefaOffmWg==
X-Google-Smtp-Source: ABdhPJyIP6sx7q0rpLGy9YlfgnYRB7GLxPiYzY6g23EfN4s5rpp5X2X/JpRuRxxpfTPxkVC8ChMOCw==
X-Received: by 2002:a05:6000:91:: with SMTP id
 m17mr10073707wrx.250.1640533173288; 
 Sun, 26 Dec 2021 07:39:33 -0800 (PST)
Received: from [192.168.0.6] ([46.251.119.176])
 by smtp.googlemail.com with ESMTPSA id p13sm3033070wrs.54.2021.12.26.07.39.32
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sun, 26 Dec 2021 07:39:32 -0800 (PST)
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
To: Ashwin Kafle <ashwin@HIDDEN>, Juri Linkov <juri@HIDDEN>
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>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <b20daeab-29b5-c116-4a43-52649374aab0@HIDDEN>
Date: Sun, 26 Dec 2021 17:38:22 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <85czljcund.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.4 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org
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: -0.6 (/)

On 26.12.2021 17:23, Ashwin Kafle wrote:
> Say you use the current vc-delete-file and then immediately restore it
> from backup (before commiting).  VC will show the file as unregistered.
> I think this behavior of vc should be fixed instead.

What would you have it do instead?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 26 Dec 2021 14:30:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 26 09:30:41 2021
Received: from localhost ([127.0.0.1]:40390 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1n1UXp-00050o-D4
	for submit <at> debbugs.gnu.org; Sun, 26 Dec 2021 09:30:41 -0500
Received: from forward102o.mail.yandex.net ([37.140.190.182]:56662)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ashwin@HIDDEN>) id 1n1UXl-00050Y-VN
 for 52507 <at> debbugs.gnu.org; Sun, 26 Dec 2021 09:30:39 -0500
Received: from iva8-c786f07cfd6d.qloud-c.yandex.net
 (iva8-c786f07cfd6d.qloud-c.yandex.net
 [IPv6:2a02:6b8:c0c:7211:0:640:c786:f07c])
 by forward102o.mail.yandex.net (Yandex) with ESMTP id DEEA26FF81A5;
 Sun, 26 Dec 2021 17:30:30 +0300 (MSK)
Received: from iva6-2d18925256a6.qloud-c.yandex.net
 (iva6-2d18925256a6.qloud-c.yandex.net [2a02:6b8:c0c:7594:0:640:2d18:9252])
 by iva8-c786f07cfd6d.qloud-c.yandex.net (mxback/Yandex) with ESMTP id
 rae4y1No8f-UUeG7RS9; Sun, 26 Dec 2021 17:30:30 +0300
Authentication-Results: iva8-c786f07cfd6d.qloud-c.yandex.net; dkim=pass
Received: by iva6-2d18925256a6.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA
 id 1KXsNS9vlA-USPWIwvg; Sun, 26 Dec 2021 17:30:29 +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: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <86a6h13j4i.fsf@HIDDEN> <85o85hsr3b.fsf@HIDDEN>
 <861r2dzqrj.fsf@HIDDEN> <85fsqt67y1.fsf@HIDDEN>
 <8535mt67k8.fsf@HIDDEN> <86k0g4a875.fsf@HIDDEN>
 <f6dc58c6-3139-0dd4-f695-a6162fffe906@HIDDEN>
Date: Sun, 26 Dec 2021 14:31:38 +0000
In-Reply-To: <f6dc58c6-3139-0dd4-f695-a6162fffe906@HIDDEN> (Dmitry Gutov's
 message of "Mon, 20 Dec 2021 02:46:29 +0300")
Message-ID: <858rw7cu9h.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.7 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org, Ashwin Kafle <ashwin@HIDDEN>,
 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: -1.7 (-)

Dmitry Gutov <dgutov@HIDDEN> writes:


>> Then after this, the user can manually rename the unregistered backup
>> by removing ~ from the file name.
>> So it seems that you want to automate the last part, i.e.
>> to try automatically rename the file from its backup copy
>> after all changes were committed?
>
> So a "restore from backup" step indeed could be a solution for this problem.

For current vc, restore from backup would only work after a commit which
i don't think is desirable much as you could go days without a commit
and 'C-u C-x v x' saying it will not delete the file would be wrong.

I don't know vc-internals but vc-git using git's --porcelain as juri
said is probably a much better idea.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 26 Dec 2021 14:22:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 26 09:22:21 2021
Received: from localhost ([127.0.0.1]:40381 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1n1UPl-0004mO-6E
	for submit <at> debbugs.gnu.org; Sun, 26 Dec 2021 09:22:21 -0500
Received: from forward100p.mail.yandex.net ([77.88.28.100]:53934)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ashwin@HIDDEN>) id 1n1UPi-0004m7-Tj
 for 52507 <at> debbugs.gnu.org; Sun, 26 Dec 2021 09:22:20 -0500
Received: from myt5-30ca2e5366d2.qloud-c.yandex.net
 (myt5-30ca2e5366d2.qloud-c.yandex.net
 [IPv6:2a02:6b8:c12:fa5:0:640:30ca:2e53])
 by forward100p.mail.yandex.net (Yandex) with ESMTP id 2A33F4F0802E;
 Sun, 26 Dec 2021 17:22:11 +0300 (MSK)
Received: from myt5-aad1beefab42.qloud-c.yandex.net
 (myt5-aad1beefab42.qloud-c.yandex.net [2a02:6b8:c12:128:0:640:aad1:beef])
 by myt5-30ca2e5366d2.qloud-c.yandex.net (mxback/Yandex) with ESMTP id
 Nj6AKqBKEX-MAeaE2oE; Sun, 26 Dec 2021 17:22:11 +0300
Authentication-Results: myt5-30ca2e5366d2.qloud-c.yandex.net; dkim=pass
Received: by myt5-aad1beefab42.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA
 id fw3RXzbzDe-M9Pu9SKR; Sun, 26 Dec 2021 17:22:10 +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: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <86a6h13j4i.fsf@HIDDEN> <85o85hsr3b.fsf@HIDDEN>
 <861r2dzqrj.fsf@HIDDEN> <85fsqt67y1.fsf@HIDDEN>
 <8535mt67k8.fsf@HIDDEN> <86k0g4a875.fsf@HIDDEN>
Date: Sun, 26 Dec 2021 14:23:18 +0000
In-Reply-To: <86k0g4a875.fsf@HIDDEN> (Juri Linkov's message of "Thu, 
 16 Dec 2021 19:01:20 +0200")
Message-ID: <85czljcund.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: 52507
Cc: 52507 <at> debbugs.gnu.org, Ashwin Kafle <ashwin@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 (-)

Juri Linkov <juri@HIDDEN> writes:

> --cached can't be used anyway, because vc commands doesn't use the git index.

It's not --cached that is the problem.  Even the unpatched
vc-delete-file effectively uses --cached because the file is removed
while backuping and never brought back for git to delete it.

Say you use the current vc-delete-file and then immediately restore it
from backup (before commiting).  VC will show the file as unregistered.
I think this behavior of vc should be fixed instead.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 24 Dec 2021 00:49:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 23 19:49:19 2021
Received: from localhost ([127.0.0.1]:35291 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1n0Ylq-0008J5-Sh
	for submit <at> debbugs.gnu.org; Thu, 23 Dec 2021 19:49:19 -0500
Received: from mail-wr1-f49.google.com ([209.85.221.49]:43697)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1n0Ylp-0008Is-RZ
 for 52507 <at> debbugs.gnu.org; Thu, 23 Dec 2021 19:49:18 -0500
Received: by mail-wr1-f49.google.com with SMTP id v11so14484951wrw.10
 for <52507 <at> debbugs.gnu.org>; Thu, 23 Dec 2021 16:49:17 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=E7hzIKlJaStNqrBprMb4sKVY6TX8DAMoxyYfWfIy+rU=;
 b=NYEQCjJ5onsMgnLOxoVolV40v6NG+zZt9WkHMSCvvrK23rTD/u1NDWkjBy66uiVdr0
 5InxKKKKHAWUxnbD9ZNm8zny+8DmOE+mCy5gW53AGWbLyGUUeOBM/6pjEEDtCKJe2/FX
 2xIh3E6WbdXDfJMo2SzORxmSHjzxYn0vvvNX375Ua2L+YL06YKjoN+J4ZaF40wnmZORj
 LtVzLZvZ07cP6uMmNiZLKW4RxLofVe7hZu0WZ3cY16YeZYfYRqyViPD1LnBqLqCrIvlI
 66wPTmMoWrMosFLODpTVN1PQOy1kvV2e6feNbFdLiOcvkPRJ+VEaWEZjt+kBhE7jQNi/
 IkEg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=E7hzIKlJaStNqrBprMb4sKVY6TX8DAMoxyYfWfIy+rU=;
 b=uAicGQkiTVkB8VkZptHfdPl/o4wwYwGed3MHEVtJW3tf8vGB234xGUNaxNzRBgac3e
 fvPsJngjLQPDO1LUZ3HM8uvt8Bk8+iQT5nrEDplpvqDSp3P9C7XPRirfVMoW00rhLT5i
 UBAX57hWLghOja0UM9O4fN0lqNNtuXPkgSZwvxhP+fHmjjZN0V1sDRwqxdUWDxS/COXb
 R+j9D8PUeGR01nXO2KLklAzfLA1sAoxvWdM7Krf2poTMSdILm9PmpHlU8SfrvOdXh/CB
 hQOW/0AHVHQl2LbibrS3bFlmCPmktZlwOiaEHbGJlMvT1xXG1eumTJCn+CJfoO4mjcQe
 5eZA==
X-Gm-Message-State: AOAM532AXLr94bX4YhkQTT+0ugFaLJwwtq+5aRqBeJ92zSx365T7ErmT
 nHJ2ZdxKye7vsaNJ+v8Rk8s3mNKaquo=
X-Google-Smtp-Source: ABdhPJy6nLWj3lNDXcWQZENfSsMg7jTkfo+eB/kmrGqYP/NRKxsJVSW3Htca4C5QBTfTQhyc7E414Q==
X-Received: by 2002:a5d:4090:: with SMTP id o16mr3142772wrp.692.1640306952276; 
 Thu, 23 Dec 2021 16:49:12 -0800 (PST)
Received: from [192.168.0.6] ([46.251.119.176])
 by smtp.googlemail.com with ESMTPSA id d143sm5844645wmd.6.2021.12.23.16.49.11
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 23 Dec 2021 16:49:11 -0800 (PST)
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
To: Juri Linkov <juri@HIDDEN>
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <86a6h13j4i.fsf@HIDDEN> <85o85hsr3b.fsf@HIDDEN>
 <861r2dzqrj.fsf@HIDDEN> <85fsqt67y1.fsf@HIDDEN>
 <8535mt67k8.fsf@HIDDEN> <86k0g4a875.fsf@HIDDEN>
 <f6dc58c6-3139-0dd4-f695-a6162fffe906@HIDDEN>
 <86ilvfba32.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <49062cc5-64e2-3214-4e8f-bc496b04e15e@HIDDEN>
Date: Fri, 24 Dec 2021 02:48:01 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <86ilvfba32.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.4 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org, Ashwin Kafle <ashwin@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: -0.6 (/)

On 23.12.2021 20:20, Juri Linkov wrote:
> I doubt that anyone might want to commit the file deletion immediately,
> because file deletions usually are committed together with other changes.

Right. That's why I suggested either to have a buffer-local var to store 
the "to be deleted" status, or do that in the staging area first.

> But maybe git has a way to mark a file as deleted without actually deleting it?
> So `git status --porcelain -z --untracked-files` could return "D" for such file
> that still exists, this would be the simplest solution.

'git rm --cached', used in the patch for this issue originally, is 
indeed such command. Unless I misunderstood the question.

$ git rm --cached CONTRIBUTE
rm 'CONTRIBUTE' 
                                  $ git status --porcelain --untracked-files
D  CONTRIBUTE
?? CONTRIBUTE




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 23 Dec 2021 17:33:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 23 12:33:58 2021
Received: from localhost ([127.0.0.1]:34815 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1n0RyY-0007jp-FK
	for submit <at> debbugs.gnu.org; Thu, 23 Dec 2021 12:33:58 -0500
Received: from relay7-d.mail.gandi.net ([217.70.183.200]:56433)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1n0RyV-0007jN-FW
 for 52507 <at> debbugs.gnu.org; Thu, 23 Dec 2021 12:33:57 -0500
Received: (Authenticated sender: juri@HIDDEN)
 by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id C17EF20005;
 Thu, 23 Dec 2021 17:33:47 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
Organization: LINKOV.NET
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <86a6h13j4i.fsf@HIDDEN> <85o85hsr3b.fsf@HIDDEN>
 <861r2dzqrj.fsf@HIDDEN> <85fsqt67y1.fsf@HIDDEN>
 <8535mt67k8.fsf@HIDDEN> <86k0g4a875.fsf@HIDDEN>
 <f6dc58c6-3139-0dd4-f695-a6162fffe906@HIDDEN>
Date: Thu, 23 Dec 2021 19:20:45 +0200
In-Reply-To: <f6dc58c6-3139-0dd4-f695-a6162fffe906@HIDDEN> (Dmitry Gutov's
 message of "Mon, 20 Dec 2021 02:46:29 +0300")
Message-ID: <86ilvfba32.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org, Ashwin Kafle <ashwin@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.7 (-)

> Or alternatively, if we consider the potential feature which we've been
> talking about (committing a subset of hunks from a file selectively), its
> implementation should have a step which either uses a staging area, or adds
> stuff to it first.
>
> And that step could be the place to enact a change like presently discussed
> (add a deletion to the staging area, and then commit it). That deletion
> would either already be in the staging area (meaning we pick up any staged
> changes for commit, which might be weird), or we would store the "intent to
> remove with --cached" in some buffer-local variable, which would be picked
> up by the new code.
>
> The latter solution would be the "cleaner" one, but the former is one that
> we could have _right now_.
>
> On the plus side, the former also doesn't seem like it's going to require
> changes in the VC API after all.

The feature of committing a subset of hunks will be performed by one command
'log-edit-done' ('C-c C-c') from the *vc-log* buffer that will run git commands
`git apply --cached` followed by `git commit`.

Doing something similar could mean for example that 'C-u M-x vc-delete-file'
could immediately pop up the *vc-log* buffer waiting for a commit message,
and on 'C-c C-c' will commit only the deleted file.

I doubt that anyone might want to commit the file deletion immediately,
because file deletions usually are committed together with other changes.

But maybe git has a way to mark a file as deleted without actually deleting it?
So `git status --porcelain -z --untracked-files` could return "D" for such file
that still exists, this would be the simplest solution.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 19 Dec 2021 23:47:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 19 18:47:38 2021
Received: from localhost ([127.0.0.1]:48488 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mz5ty-0002TM-48
	for submit <at> debbugs.gnu.org; Sun, 19 Dec 2021 18:47:38 -0500
Received: from mail-wr1-f53.google.com ([209.85.221.53]:36598)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1mz5tw-0002Sm-Vv
 for 52507 <at> debbugs.gnu.org; Sun, 19 Dec 2021 18:47:37 -0500
Received: by mail-wr1-f53.google.com with SMTP id r17so16192392wrc.3
 for <52507 <at> debbugs.gnu.org>; Sun, 19 Dec 2021 15:47:36 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=nfXZaN7edxXF22GxCqRVib/IkkPzzLW+zzZ4WvXCnLI=;
 b=KD1aEvzgyT+fC6mUbGbjTqMQwydlDmIaEhbgKBK5J9nmsAdZ/fCTd7byBk2mHQR9vG
 u0HsBOkYrStoA1X6O5fyvOXiFc3nBI4RKGHd2AcfjkBYZ+2Qw29koOsVOCeSk5hz1GMW
 VexwxPRkqwPEEayn3sDJVN0ZYryVAat4OGwijx16ppZ5Yw5OerwuKz9pZ5RwKibalUjN
 FV10aQQWu0YtRmOW1MxtdaXs/307z8GdkOs2eo+LvX6JjBSKAJI8mwlJ43hSIBLtISVt
 GBGTmKGwpyOCMxNkRAwSIW0UPz+fO8tC2BkEhLrLDaImoJ4y3N6h+I5NQTclm2XFQXlg
 2yAw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=nfXZaN7edxXF22GxCqRVib/IkkPzzLW+zzZ4WvXCnLI=;
 b=dsnzAVSKitNtpz6VUCIWwDlIt57hwA5H6PjMIkNAESIxXTJV0dj/uHYoG7YluJ7ZuN
 elz5opGjjPn4smnNxSlmNypqlORuVAfxuCgO6hmqYytPtRJsPMu9ZJf2Ddri1F6S6s95
 oZcVJ+DJhg8kjiBfqwBw2hKNAYKdmKRPDjX+q+nQLWFf3/nam5dWu5kxM0dfcpD39Nv2
 JegBxCpVvdasKW1r+S87868+NT9rFQ1q9wydQ0Z1U+2BugAckSoXHCLeA9EOpwayKXR0
 xNuYALIdk7xAIe9wUTZqtPl4QiIyEnohA4SHWPkj91LxOPc/NhI+daCBFD9TXAluVOy5
 ZnpQ==
X-Gm-Message-State: AOAM531xRPodafETztGX2s8lcDSS2KE4KDY2Uhm2QP2svYxwoTYGlm1l
 jGe2/YN5joTN/01z9PdCUNPTplL6lSI=
X-Google-Smtp-Source: ABdhPJy3nNwzOx5Fkv1aesIbs4io52WAPxTyrubB9gNCB2sBuyNfgbvNEn08r985s/yrYggfAjhwBg==
X-Received: by 2002:a05:6000:1867:: with SMTP id
 d7mr10948454wri.21.1639957651083; 
 Sun, 19 Dec 2021 15:47:31 -0800 (PST)
Received: from [10.112.52.244] ([185.213.155.252])
 by smtp.googlemail.com with ESMTPSA id i15sm21372182wmq.18.2021.12.19.15.47.30
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sun, 19 Dec 2021 15:47:30 -0800 (PST)
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
To: Juri Linkov <juri@HIDDEN>, Ashwin Kafle <ashwin@HIDDEN>
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <86a6h13j4i.fsf@HIDDEN> <85o85hsr3b.fsf@HIDDEN>
 <861r2dzqrj.fsf@HIDDEN> <85fsqt67y1.fsf@HIDDEN>
 <8535mt67k8.fsf@HIDDEN> <86k0g4a875.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <f6dc58c6-3139-0dd4-f695-a6162fffe906@HIDDEN>
Date: Mon, 20 Dec 2021 02:46:29 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <86k0g4a875.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.4 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org
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: -0.6 (/)

On 16.12.2021 20:01, Juri Linkov wrote:
> --cached can't be used anyway, because vc commands doesn't use the git index.
> Currently, after vc-delete-file, we have the following status in vc-dir:
> 
>                           ./
>       removed             file1
>       unregistered        file1~
> 
> So the user can commit the removed file with vc-next-action.

That's a very good point, I didn't even consider this problem (VC not 
caring about the staging area). Perhaps assuming that the full scenario 
with the original patch is functional.

> Then after this, the user can manually rename the unregistered backup
> by removing ~ from the file name.
> 
> So it seems that you want to automate the last part, i.e.
> to try automatically rename the file from its backup copy
> after all changes were committed?

So a "restore from backup" step indeed could be a solution for this problem.

Or alternatively, if we consider the potential feature which we've been 
talking about (committing a subset of hunks from a file selectively), 
its implementation should have a step which either uses a staging area, 
or adds stuff to it first.

And that step could be the place to enact a change like presently 
discussed (add a deletion to the staging area, and then commit it). That 
deletion would either already be in the staging area (meaning we pick up 
any staged changes for commit, which might be weird), or we would store 
the "intent to remove with --cached" in some buffer-local variable, 
which would be picked up by the new code.

The latter solution would be the "cleaner" one, but the former is one 
that we could have _right now_.

On the plus side, the former also doesn't seem like it's going to 
require changes in the VC API after all.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 16 Dec 2021 17:35:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 16 12:35:14 2021
Received: from localhost ([127.0.0.1]:36569 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mxuew-0005yw-0N
	for submit <at> debbugs.gnu.org; Thu, 16 Dec 2021 12:35:14 -0500
Received: from relay10.mail.gandi.net ([217.70.178.230]:35987)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1mxuet-0005yY-TY
 for 52507 <at> debbugs.gnu.org; Thu, 16 Dec 2021 12:35:12 -0500
Received: (Authenticated sender: juri@HIDDEN)
 by relay10.mail.gandi.net (Postfix) with ESMTPSA id 8F67624000C;
 Thu, 16 Dec 2021 17:35:03 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Ashwin Kafle <ashwin@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
Organization: LINKOV.NET
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <86a6h13j4i.fsf@HIDDEN> <85o85hsr3b.fsf@HIDDEN>
 <861r2dzqrj.fsf@HIDDEN> <85fsqt67y1.fsf@HIDDEN>
 <8535mt67k8.fsf@HIDDEN>
Date: Thu, 16 Dec 2021 19:01:20 +0200
In-Reply-To: <8535mt67k8.fsf@HIDDEN> (Ashwin Kafle's message of "Wed, 
 15 Dec 2021 18:34:31 +0000")
Message-ID: <86k0g4a875.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org
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.7 (-)

>>>  (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" "--")))
>>>
>>> because it deletes the file in the staging area
>>> that is not used by vc-git, so there is no way
>>> to commit the deletion using vc commands.
>> ...
> Oh, you mean just that single commit can't be done by vc now.  Yeah,
> that seems true. Can you think of any solution for that here?

--cached can't be used anyway, because vc commands doesn't use the git index.
Currently, after vc-delete-file, we have the following status in vc-dir:

                         ./
     removed             file1
     unregistered        file1~

So the user can commit the removed file with vc-next-action.
Then after this, the user can manually rename the unregistered backup
by removing ~ from the file name.

So it seems that you want to automate the last part, i.e.
to try automatically rename the file from its backup copy
after all changes were committed?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 16 Dec 2021 14:06:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 16 09:06:28 2021
Received: from localhost ([127.0.0.1]:35111 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mxrOt-0008Kk-T7
	for submit <at> debbugs.gnu.org; Thu, 16 Dec 2021 09:06:28 -0500
Received: from forward104j.mail.yandex.net ([5.45.198.247]:50776)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ashwin@HIDDEN>) id 1mxrOp-0008KQ-R1
 for 52507 <at> debbugs.gnu.org; Thu, 16 Dec 2021 09:06:26 -0500
Received: from sas1-df919fd4523f.qloud-c.yandex.net
 (sas1-df919fd4523f.qloud-c.yandex.net
 [IPv6:2a02:6b8:c14:4495:0:640:df91:9fd4])
 by forward104j.mail.yandex.net (Yandex) with ESMTP id B6AC42F99C8D;
 Thu, 16 Dec 2021 17:06:16 +0300 (MSK)
Received: from sas8-c6148047b62a.qloud-c.yandex.net
 (sas8-c6148047b62a.qloud-c.yandex.net [2a02:6b8:c1b:2a11:0:640:c614:8047])
 by sas1-df919fd4523f.qloud-c.yandex.net (mxback/Yandex) with ESMTP id
 9buTTC09hG-6GeG5jaV; Thu, 16 Dec 2021 17:06:16 +0300
Authentication-Results: sas1-df919fd4523f.qloud-c.yandex.net; dkim=pass
Received: by sas8-c6148047b62a.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA
 id hgD3SNxN4z-6EQmEsow; Thu, 16 Dec 2021 17:06:15 +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: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#52507: [PATCH v3] Option for vc-delete-file to keep file on
 disk
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <d20e0129-91ca-d2b9-70f3-3179abbb4de9@HIDDEN>
 <85pmpxvx8z.fsf@HIDDEN>
 <817fe109-8afe-62fc-e80e-f3d0ef4e4889@HIDDEN>
 <85lf0kdc3v.fsf@HIDDEN>
 <992c1811-d85f-0d54-6e5c-d19da41bc996@HIDDEN>
Date: Thu, 16 Dec 2021 14:07:15 +0000
In-Reply-To: <992c1811-d85f-0d54-6e5c-d19da41bc996@HIDDEN> (Dmitry Gutov's
 message of "Thu, 16 Dec 2021 14:27:00 +0300")
Message-ID: <854k788wz0.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: 52507
Cc: 52507 <at> debbugs.gnu.org, Ashwin Kafle <ashwin@HIDDEN>,
 Eli Zaretskii <eliz@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

Dmitry Gutov <dgutov@HIDDEN> writes:

[...]
>> But then the user will get error about wrong number of arguments if
>> the
>> backend doesn't support it.
>
> That's better than having the file deleted, I think.
>
> And our implementation can catch this particular error and show a more
> humane message, too.

With the attached patch, the file will not be deleted when prefix is given.


[...]
>> I think it would be better to check if the file exists after calling
>> vc
>> backends.  If it doesn't and keep-files is non-nil, we can restore from the
>> backup(which is always happening).
>
> Couldn't backups be disabled?

The attached patch changes make-backup-files temporarily.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Option-for-vc-delete-file-to-keep-file-on-disk.patch

From 846a92e9623a05d49d0026a62697a39d0e7690a7 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. Also have it manage backup files in
case the backend delets files when we don't want to.
---
 doc/emacs/vc1-xtra.texi |  3 ++-
 etc/NEWS                |  4 ++++
 lisp/vc/vc-git.el       |  4 ++--
 lisp/vc/vc.el           | 32 +++++++++++++++++++++-----------
 4 files changed, 29 insertions(+), 14 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..8d393282cc 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)))
@@ -2996,22 +2999,29 @@ vc-delete-file
     (unless (y-or-n-p (format "Really want to delete %s? "
 			      (file-name-nondirectory file)))
       (error "Abort!"))
-    (unless (or (file-directory-p file) (null make-backup-files)
-                (not (file-exists-p file)))
+    (when (or (not (file-directory-p file))
+              (file-exists-p file))
       (with-current-buffer (or buf (find-file-noselect file))
-	(let ((backup-inhibited nil))
+	(let ((backup-inhibited nil)
+              (make-backup-files t)
+              ;; 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))
+    ;; If the file dosen't exist when we want to or vice-versa, fix that.
+    (let ((back-file (car (file-backup-file-names file))))
+      (if (file-exists-p file)
+          (if (not keep-file) (delete-file file))
+        (when (and keep-file back-file)
+          (copy-file back-file file t t t t)))
+      (unless make-backup-files (delete-file back-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)))
+    ;; Make sure the *vc-dir* buffers are updated after this.
+    (vc-resynch-buffer file keep-file t)))
 
 ;;;###autoload
 (defun vc-rename-file (old new)
-- 
2.34.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 16 Dec 2021 11:28:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 16 06:28:08 2021
Received: from localhost ([127.0.0.1]:34850 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mxovg-0001go-BD
	for submit <at> debbugs.gnu.org; Thu, 16 Dec 2021 06:28:08 -0500
Received: from mail-lj1-f174.google.com ([209.85.208.174]:37852)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1mxovd-0001gD-5O
 for 52507 <at> debbugs.gnu.org; Thu, 16 Dec 2021 06:28:07 -0500
Received: by mail-lj1-f174.google.com with SMTP id k2so38001201lji.4
 for <52507 <at> debbugs.gnu.org>; Thu, 16 Dec 2021 03:28:05 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=FiieLnelA/DLExoU75i2vlx1DPUpObEwo+EMtrM9hIY=;
 b=aL80yW174fTL/P+najP6t9zSEg5CLRoCJwuBo9oWJRWFIy6VnVWSu9RFgFnNs3PP++
 nk1YnCmAB5D1urfJ/pXpkgfkZsi9oJ1euPWQ/iaMFEDnjlXffhb0ob1TaPCY98FlglJ6
 8+apThuSsoy7jsFw1GJ4Ck4UoI8K6BMHO33S9VLCyYkEAq5dHjebtCe0cnKucgtkP0Ng
 ultLLWBcG5Hjh4L1XaL+kZwdJmggTH2Cu38yp5EzOgpQgobrFS4rYvWS2rKpyvvk0dXU
 fiPXUQK7Da0dL9SxF9vQB9WJmT+9iqLW202xak53BVX6VCKmTLvTLOZDauA6xz6FArWz
 yegw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=FiieLnelA/DLExoU75i2vlx1DPUpObEwo+EMtrM9hIY=;
 b=Hd8OgfecKBq9ptTfUYy9gL3kqj49+NM8bS9Sup4UoOcnkbqMFa69jbpz39PY2gfQ+e
 6om9I0m4wS6whC4Ru3ecelTf9fS7jxbeRpGPPNJ7Hu+Zqcnp5dSDgrVDDfz9C0/3LpXU
 eMUklf9QOGppVHr8sV8BjTx/x0PWozJSsxi6cyg+/VSiW/uQ+SlNVpab/3QPYIXpE0oG
 03EyaK7J1mNpZ3k+XXJyFStXQ6yjgd+7E6I8p8UAUIeyR7tcmCM9Tj1Mj+w+lhn055IM
 pDwFuUwk4tQ5v8aA/ZaH+aE+J2FovEsnG6E7FtblsH1BPFIzWgEttiW5wFYq0d0Ju7p7
 lkeQ==
X-Gm-Message-State: AOAM533hJfei6KdhqeAOYroZWvyX8FJlWhF00TTm/6HvOIPZqXlbsMMY
 Orcm/xrvVGPVG0LKjORzyJHZl4qaiWT1Fg==
X-Google-Smtp-Source: ABdhPJyFhvMqfOUI6UT8UMgZo0RTkA9vHT/2q3TmKUuJx/cTWG8nrpY9VzBxZR7P4yNLyOBzyHuRTA==
X-Received: by 2002:a05:651c:b0e:: with SMTP id
 b14mr14924736ljr.38.1639654079136; 
 Thu, 16 Dec 2021 03:27:59 -0800 (PST)
Received: from [192.168.0.103] ([5.18.233.185])
 by smtp.googlemail.com with ESMTPSA id i17sm821489lfe.281.2021.12.16.03.27.58
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 16 Dec 2021 03:27:58 -0800 (PST)
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
To: Ashwin Kafle <ashwin@HIDDEN>
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <d20e0129-91ca-d2b9-70f3-3179abbb4de9@HIDDEN>
 <85pmpxvx8z.fsf@HIDDEN>
 <817fe109-8afe-62fc-e80e-f3d0ef4e4889@HIDDEN>
 <85lf0kdc3v.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <992c1811-d85f-0d54-6e5c-d19da41bc996@HIDDEN>
Date: Thu, 16 Dec 2021 14:27:00 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <85lf0kdc3v.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.4 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org
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: -0.6 (/)

On 16.12.2021 14:26, Ashwin Kafle wrote:
> Dmitry Gutov <dgutov@HIDDEN> writes:
> 
>> On 16.12.2021 10:12, Ashwin Kafle wrote:
>>> But this would mean that every vc-backend will have to be changed,
>>> immediately.
>>
>> Not really: since the arg is optional, we can make sure to only add it
>> when it's non-nil, and otherwise call the backends with 1 argument.
> 
> But then the user will get error about wrong number of arguments if the
> backend doesn't support it.

That's better than having the file deleted, I think.

And our implementation can catch this particular error and show a more 
humane message, too.

>>
>>> Also, having every vc-backend accept and check keep-on-disk will result
>>> on a lot of duplicate code that can simply be avoided.
>>
>> That's a valid argument, I suppose. Depends on whether many other
>> backends (VCSes) know how to delete files without deleting them on
>> disk.
>>
>> OTOH, it would be handy to let those that don't declare explicitly
>> their inability to do that (by not supporting the second argument).
> 
> I think it would be better to check if the file exists after calling vc
> backends.  If it doesn't and keep-files is non-nil, we can restore from the
> backup(which is always happening).

Couldn't backups be disabled?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 16 Dec 2021 11:25:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 16 06:25:55 2021
Received: from localhost ([127.0.0.1]:34846 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mxotW-0001bs-ON
	for submit <at> debbugs.gnu.org; Thu, 16 Dec 2021 06:25:55 -0500
Received: from forward102o.mail.yandex.net ([37.140.190.182]:36638)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ashwin@HIDDEN>) id 1mxotU-0001aK-8r
 for 52507 <at> debbugs.gnu.org; Thu, 16 Dec 2021 06:25:53 -0500
Received: from iva5-234a6f14a091.qloud-c.yandex.net
 (iva5-234a6f14a091.qloud-c.yandex.net
 [IPv6:2a02:6b8:c0c:e87:0:640:234a:6f14])
 by forward102o.mail.yandex.net (Yandex) with ESMTP id AA0DA6FF9F94
 for <52507 <at> debbugs.gnu.org>; Thu, 16 Dec 2021 14:25:44 +0300 (MSK)
Received: from iva5-057a0d1fbbd8.qloud-c.yandex.net
 (iva5-057a0d1fbbd8.qloud-c.yandex.net [2a02:6b8:c0c:7f1c:0:640:57a:d1f])
 by iva5-234a6f14a091.qloud-c.yandex.net (mxback/Yandex) with ESMTP id
 XUTYIgmjYT-PifGoi0b; Thu, 16 Dec 2021 14:25:44 +0300
Authentication-Results: iva5-234a6f14a091.qloud-c.yandex.net; dkim=pass
Received: by iva5-057a0d1fbbd8.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA
 id WMNElgEiKN-PhQeh5kh; Thu, 16 Dec 2021 14:25:43 +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: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <d20e0129-91ca-d2b9-70f3-3179abbb4de9@HIDDEN>
 <85pmpxvx8z.fsf@HIDDEN>
 <817fe109-8afe-62fc-e80e-f3d0ef4e4889@HIDDEN>
Date: Thu, 16 Dec 2021 11:26:44 +0000
In-Reply-To: <817fe109-8afe-62fc-e80e-f3d0ef4e4889@HIDDEN> (Dmitry Gutov's
 message of "Thu, 16 Dec 2021 13:03:43 +0300")
Message-ID: <85lf0kdc3v.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.7 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org, Ashwin Kafle <ashwin@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.7 (-)

Dmitry Gutov <dgutov@HIDDEN> writes:

> On 16.12.2021 10:12, Ashwin Kafle wrote:
>> But this would mean that every vc-backend will have to be changed,
>> immediately.
>
> Not really: since the arg is optional, we can make sure to only add it
> when it's non-nil, and otherwise call the backends with 1 argument.

But then the user will get error about wrong number of arguments if the
backend doesn't support it.

>
>> Also, having every vc-backend accept and check keep-on-disk will result
>> on a lot of duplicate code that can simply be avoided.
>
> That's a valid argument, I suppose. Depends on whether many other
> backends (VCSes) know how to delete files without deleting them on
> disk.
>
> OTOH, it would be handy to let those that don't declare explicitly
> their inability to do that (by not supporting the second argument).

I think it would be better to check if the file exists after calling vc
backends.  If it doesn't and keep-files is non-nil, we can restore from the
backup(which is always happening).  That will make all vc backends
compatible without any change.

If other backends support deletion only from the index, then they should
do that as it preserves file-modes and such.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 16 Dec 2021 10:04:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 16 05:04:50 2021
Received: from localhost ([127.0.0.1]:34674 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mxnd3-0007WN-TN
	for submit <at> debbugs.gnu.org; Thu, 16 Dec 2021 05:04:50 -0500
Received: from mail-wr1-f52.google.com ([209.85.221.52]:43706)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1mxnd2-0007W8-Eo
 for 52507 <at> debbugs.gnu.org; Thu, 16 Dec 2021 05:04:48 -0500
Received: by mail-wr1-f52.google.com with SMTP id v11so43119255wrw.10
 for <52507 <at> debbugs.gnu.org>; Thu, 16 Dec 2021 02:04:48 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=pKgwfusLidATPTOhkrSSTOkmiq6CZnIO6REPv5KKJHs=;
 b=JW86d+KW40Y14HQRktu4yFcKY1tU30laSVrJ7bsH7jGt5DM7VCw+3F7/iWc1wvVZS5
 8JkTRGcqn4/gswha77uyYI9hKeD0GpsGIDSL94bH7YjVh0jt5I5S/wSiuVvHoipBajel
 4Etbn83ieF/78pA9VxfDDSSDsQuAOjbqwf63U+TQvMjypvvSVldPF2JcX67d4g4Qjvte
 jf393K+hJ8HwTFdFZP8Vnn3Vnw9th1HC/0Mt14cvpv2N8brXakhXECeF7mxDjEip7vtI
 b94TaQNWMiDf5G528toIa16VMeL/vJNuJ9DywaqpVrvcuzZTzKD5Sskt8hfbqGuEtl9K
 xmVQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=pKgwfusLidATPTOhkrSSTOkmiq6CZnIO6REPv5KKJHs=;
 b=3KxEE+ShSVsR/OS1Gjon5ppBNA2sHey8ANHu+W5kp4hnODIubEGthhI+9taNmqTkK1
 IZIbk9650zXXMr20fC3jTfgmcY1XXjo3xZqWoeryG6ZI8/bLaeS99nlYy8eD5vLFQMMz
 LWlIWiQ9ikIsduDWcP/PPVZD6z82koEMje+QLujoEn2VKNByLy/YAzlW+bka6oDfKLDO
 E39ljZvmXiushEDHh3Si5+pJi0MFYu+Mji3JIn8BhUfJU9vyawa5BBdN72RwwCV3YK//
 L5hgZAiSC7t3Cp07fLmsVby0Dbf7swGDUyPjcULCf7j8Zhu//HEqMQaiqXng9Ofjc+jy
 FjmQ==
X-Gm-Message-State: AOAM530ZkqTaTf/zLtGIdh5mNQ3Wl8pf/nicotVLN5lNtJeTijKxKfpo
 IjY87OhbGxMt88WLQjqZgkiJNTw3CzY5FQ==
X-Google-Smtp-Source: ABdhPJyR3tMJ+LAqkqRp/3PsAsgC9He0462H9NFihzJl2dNDH9vg6jonCKO3pEJ+7IjQoTTkivkOpw==
X-Received: by 2002:adf:d0c1:: with SMTP id z1mr2117836wrh.215.1639649082354; 
 Thu, 16 Dec 2021 02:04:42 -0800 (PST)
Received: from [10.112.52.244] ([185.213.155.160])
 by smtp.googlemail.com with ESMTPSA id k7sm4390104wri.110.2021.12.16.02.04.41
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 16 Dec 2021 02:04:41 -0800 (PST)
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
To: Ashwin Kafle <ashwin@HIDDEN>
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <d20e0129-91ca-d2b9-70f3-3179abbb4de9@HIDDEN>
 <85pmpxvx8z.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <817fe109-8afe-62fc-e80e-f3d0ef4e4889@HIDDEN>
Date: Thu, 16 Dec 2021 13:03:43 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <85pmpxvx8z.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 3.0 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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
 the administrator of that system for details.
 Content preview:  On 16.12.2021 10:12, Ashwin Kafle wrote: > But this would
 mean that every vc-backend will have to be changed, > immediately. Not really:
 since the arg is optional, we can make sure to only add it when it's non-nil, 
 and otherwise call the backends with 1 argument. 
 Content analysis details:   (3.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (dgutov[at]yandex.ru)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level
 mail domains are different
 2.6 RCVD_IN_SBL            RBL: Received via a relay in Spamhaus SBL
 [185.213.155.160 listed in zen.spamhaus.org]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [209.85.221.52 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.221.52 listed in list.dnswl.org]
 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and
 EnvelopeFrom freemail headers are different
 -0.1 NICE_REPLY_A           Looks like a legit reply (A)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org
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.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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
 the administrator of that system for details.
 
 Content preview:  On 16.12.2021 10:12, Ashwin Kafle wrote: > But this would
   mean that every vc-backend will have to be changed, > immediately. Not really:
    since the arg is optional, we can make sure to only add it when it's non-nil,
    and otherwise call the backends with 1 argument. 
 
 Content analysis details:   (2.0 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [209.85.221.52 listed in wl.mailspike.net]
  2.6 RCVD_IN_SBL            RBL: Received via a relay in Spamhaus SBL
                             [185.213.155.160 listed in zen.spamhaus.org]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.221.52 listed in list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (raaahh[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level
                             mail domains are different
  0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and
                             EnvelopeFrom freemail headers are
                             different
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager
 -0.1 NICE_REPLY_A           Looks like a legit reply (A)

On 16.12.2021 10:12, Ashwin Kafle wrote:
> But this would mean that every vc-backend will have to be changed,
> immediately.

Not really: since the arg is optional, we can make sure to only add it 
when it's non-nil, and otherwise call the backends with 1 argument.

> Also, having every vc-backend accept and check keep-on-disk will result
> on a lot of duplicate code that can simply be avoided.

That's a valid argument, I suppose. Depends on whether many other 
backends (VCSes) know how to delete files without deleting them on disk.

OTOH, it would be handy to let those that don't declare explicitly their 
inability to do that (by not supporting the second argument).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 16 Dec 2021 07:11:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 16 02:11:59 2021
Received: from localhost ([127.0.0.1]:34370 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mxkvn-000067-M9
	for submit <at> debbugs.gnu.org; Thu, 16 Dec 2021 02:11:59 -0500
Received: from forward102p.mail.yandex.net ([77.88.28.102]:41310)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ashwin@HIDDEN>) id 1mxkvk-00005n-A6
 for 52507 <at> debbugs.gnu.org; Thu, 16 Dec 2021 02:11:58 -0500
Received: from sas1-9b68b0b83e4d.qloud-c.yandex.net
 (sas1-9b68b0b83e4d.qloud-c.yandex.net
 [IPv6:2a02:6b8:c14:2706:0:640:9b68:b0b8])
 by forward102p.mail.yandex.net (Yandex) with ESMTP id 8DCFD393DB0E
 for <52507 <at> debbugs.gnu.org>; Thu, 16 Dec 2021 10:11:47 +0300 (MSK)
Received: from sas1-7a2c1d25dbfc.qloud-c.yandex.net
 (sas1-7a2c1d25dbfc.qloud-c.yandex.net [2a02:6b8:c08:c9f:0:640:7a2c:1d25])
 by sas1-9b68b0b83e4d.qloud-c.yandex.net (mxback/Yandex) with ESMTP id
 U9QjRv2NhB-Bke0mjus; Thu, 16 Dec 2021 10:11:47 +0300
Authentication-Results: sas1-9b68b0b83e4d.qloud-c.yandex.net; dkim=pass
Received: by sas1-7a2c1d25dbfc.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA
 id LsxHPCJILI-BjPScrHk; Thu, 16 Dec 2021 10:11:45 +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: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <d20e0129-91ca-d2b9-70f3-3179abbb4de9@HIDDEN>
Date: Thu, 16 Dec 2021 07:12:44 +0000
In-Reply-To: <d20e0129-91ca-d2b9-70f3-3179abbb4de9@HIDDEN> (Dmitry Gutov's
 message of "Thu, 16 Dec 2021 01:59:35 +0300")
Message-ID: <85pmpxvx8z.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: 52507
Cc: 52507 <at> debbugs.gnu.org, Ashwin Kafle <ashwin@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 (-)

Dmitry Gutov <dgutov@HIDDEN> writes:

> On 15.12.2021 12:53, Ashwin Kafle wrote:
>>   (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" "--"))
>
> This changes the semantics of the 'delete-file' backend action. Kind
> of breaking strict compatibility with third-party backends.
>
> I think it would be better to add an optional argument to it instead
> (e.g. call it KEEP-FILE, just like the new arg to vc-delete-file; or
> KEEP-ON-DISK).
>
> Then git's implementation's signature will look like
>
>   (defun vc-git-delete-file (file &optional keep-on-disk)
>
> and it will decide whether to add '--cached' based on that argument.
>
> No 'delete-file' investigation will be needed as a result.

But this would mean that every vc-backend will have to be changed,
immediately.  If we keep things as-is, Existing code either both emacs and
third-party packages will continue to work with no changes.
We can then say in NEWS that all vc backends should always leave files
in disk and let vc-delete-file handle deletion from the disk.

Also, having every vc-backend accept and check keep-on-disk will result
on a lot of duplicate code that can simply be avoided.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 15 Dec 2021 23:00:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 15 18:00:42 2021
Received: from localhost ([127.0.0.1]:33990 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mxdGM-0002Vo-5H
	for submit <at> debbugs.gnu.org; Wed, 15 Dec 2021 18:00:42 -0500
Received: from mail-wr1-f44.google.com ([209.85.221.44]:45874)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1mxdGK-0002VX-4A
 for 52507 <at> debbugs.gnu.org; Wed, 15 Dec 2021 18:00:40 -0500
Received: by mail-wr1-f44.google.com with SMTP id o13so40722098wrs.12
 for <52507 <at> debbugs.gnu.org>; Wed, 15 Dec 2021 15:00:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:subject:to:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=JyETYt6c9C3r6S4UUhLiRdWNDTO0vNQWwftU0ezdZHo=;
 b=fZJ2wBdxTe1LRBvY0kq9kJBOglW5DfeWA6pGOnQcc0LOcY8F3oxPyD5kKsgWeLA/Kj
 g4ik6YEJIkrBWdnSTfpmvbpCm9a7ZXEbaYqMenoVW49rKF96IBLJ6/AOHL2xVsgn+CDH
 xWokgQdoIRKWRDwAfRxMWveJw0nvINwmcPZ1t+XVh4l1GiUJ4J5ang9DQUJ6Zm6I0lpK
 p87TexvMPQtYufdchhCj9R1a9f5fg0J1dn/CYaEM5CQEUFIcN4QsHHFF2Ff4SYhRqhI7
 N1Tz30UGVzK6+7BPCsdzp+VOQO9JJqbYnnkD1MiChxamh/ULmxa2mgUZPhYLF/HW0g/f
 O//A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:subject:to:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=JyETYt6c9C3r6S4UUhLiRdWNDTO0vNQWwftU0ezdZHo=;
 b=6ku6JpAQoL/M1jtVzCqDf6+A7lz7BvMVkO0e7EXbn4WIrusfCqKYnYa9PWVpc4iDgT
 Uahh7YeSAHq3vgLD2dAYnEvG8ha7/lGW4xLwlNry1s17715NWiBDtd8WxghRc9HixU4/
 m4YP7G/o+o0BmTLZUHRBzHOtL9xivpc6JrbemJDOG1UhQVo+pQYckek7FkfUAGi6WCWY
 BjOt9sKBFHaZYukGbabYi5T2E1d9qXxfaCkQkPjxqsRjwnshry4lvVrv/i7gZEmwvj6i
 GtSr4XGPxVDlfVk97w/hAzY3ILdS2zLCwMeurVfVVGzBktaXbuk2Fojzl9orhN/GBrtB
 Wa6g==
X-Gm-Message-State: AOAM5326mfzuu655mNHQjynLGzwpCFALkfHTYUy3Q+Vok12X6qIU2UIH
 jMLAx+ZXbG7T9mW1J8IQcFYexUM5toA=
X-Google-Smtp-Source: ABdhPJxofAprbuFM82ViMXOEW1VKsaVawrPkpff2Wa7zEbNizQjHl6gQyMy1octXWry1jVIW6DhW4g==
X-Received: by 2002:adf:9f02:: with SMTP id l2mr2446234wrf.617.1639609234126; 
 Wed, 15 Dec 2021 15:00:34 -0800 (PST)
Received: from [10.112.52.244] ([185.213.155.160])
 by smtp.googlemail.com with ESMTPSA id d15sm4302149wri.50.2021.12.15.15.00.33
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Wed, 15 Dec 2021 15:00:33 -0800 (PST)
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
To: Ashwin Kafle <ashwin@HIDDEN>, 52507 <at> debbugs.gnu.org
References: <20211215095324.18195-1-ashwin@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <d20e0129-91ca-d2b9-70f3-3179abbb4de9@HIDDEN>
Date: Thu, 16 Dec 2021 01:59:35 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <20211215095324.18195-1-ashwin@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 3.0 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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
 the administrator of that system for details.
 Content preview:  On 15.12.2021 12:53,
 Ashwin Kafle wrote: > (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-pa [...] 
 Content analysis details:   (3.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 2.6 RCVD_IN_SBL            RBL: Received via a relay in Spamhaus SBL
 [185.213.155.160 listed in zen.spamhaus.org]
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (dgutov[at]yandex.ru)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level
 mail domains are different
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.221.44 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [209.85.221.44 listed in wl.mailspike.net]
 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and
 EnvelopeFrom freemail headers are different
 -0.1 NICE_REPLY_A           Looks like a legit reply (A)
X-Debbugs-Envelope-To: 52507
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.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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
 the administrator of that system for details.
 
 Content preview:  On 15.12.2021 12:53, Ashwin Kafle wrote: > (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-pa [...] 
 
 Content analysis details:   (2.0 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [209.85.221.44 listed in wl.mailspike.net]
  2.6 RCVD_IN_SBL            RBL: Received via a relay in Spamhaus SBL
                             [185.213.155.160 listed in zen.spamhaus.org]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.221.44 listed in list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (raaahh[at]gmail.com)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level
                             mail domains are different
  0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and
                             EnvelopeFrom freemail headers are
                             different
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager
 -0.1 NICE_REPLY_A           Looks like a legit reply (A)

On 15.12.2021 12:53, Ashwin Kafle wrote:
>   (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" "--"))

This changes the semantics of the 'delete-file' backend action. Kind of 
breaking strict compatibility with third-party backends.

I think it would be better to add an optional argument to it instead 
(e.g. call it KEEP-FILE, just like the new arg to vc-delete-file; or 
KEEP-ON-DISK).

Then git's implementation's signature will look like

   (defun vc-git-delete-file (file &optional keep-on-disk)

and it will decide whether to add '--cached' based on that argument.

No 'delete-file' investigation will be needed as a result.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 15 Dec 2021 18:33:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 15 13:33:40 2021
Received: from localhost ([127.0.0.1]:33690 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mxZ5w-0005ch-2E
	for submit <at> debbugs.gnu.org; Wed, 15 Dec 2021 13:33:40 -0500
Received: from forward100p.mail.yandex.net ([77.88.28.100]:40376)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ashwin@HIDDEN>) id 1mxZ5t-0005cT-Ns
 for 52507 <at> debbugs.gnu.org; Wed, 15 Dec 2021 13:33:39 -0500
Received: from myt6-2da614b3f5d3.qloud-c.yandex.net
 (myt6-2da614b3f5d3.qloud-c.yandex.net
 [IPv6:2a02:6b8:c12:5f2e:0:640:2da6:14b3])
 by forward100p.mail.yandex.net (Yandex) with ESMTP id D07E74F0775E;
 Wed, 15 Dec 2021 21:33:30 +0300 (MSK)
Received: from myt5-aad1beefab42.qloud-c.yandex.net
 (myt5-aad1beefab42.qloud-c.yandex.net [2a02:6b8:c12:128:0:640:aad1:beef])
 by myt6-2da614b3f5d3.qloud-c.yandex.net (mxback/Yandex) with ESMTP id
 ww84Gq9XsL-XUeerOSL; Wed, 15 Dec 2021 21:33:30 +0300
Authentication-Results: myt6-2da614b3f5d3.qloud-c.yandex.net; dkim=pass
Received: by myt5-aad1beefab42.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA
 id ktsMMKdRwj-XTPKrnJK; Wed, 15 Dec 2021 21:33:29 +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: Ashwin Kafle <ashwin@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <86a6h13j4i.fsf@HIDDEN> <85o85hsr3b.fsf@HIDDEN>
 <861r2dzqrj.fsf@HIDDEN> <85fsqt67y1.fsf@HIDDEN>
Date: Wed, 15 Dec 2021 18:34:31 +0000
In-Reply-To: <85fsqt67y1.fsf@HIDDEN> (Ashwin Kafle's message of "Wed, 
 15 Dec 2021 18:26:14 +0000")
Message-ID: <8535mt67k8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <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: -1.0 (-)

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Ashwin Kafle <ashwin@HIDDEN> writes:

>> Also it looks that your another change is dangerous:
>>
>>  (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" "--ca=
ched" "--")))
>>
>> because it deletes the file in the staging area
>> that is not used by vc-git, so there is no way
>> to commit the deletion using vc commands.
>
> I think this check in vc-delete-file takes care of that
>
> (when (eq state 'edited)
>         (error "Please commit or undo your changes before deleting %s" fi=
le))

Oh, you mean just that single commit can't be done by vc now.  Yeah,
that seems true. Can you think of any solution for that here?=20



--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQHKBAEBCAA0FiEEvNoXmdYXLw2CzQ66EHbebDayoY8FAmG6NTcWHGFzaHdpbkBh
c2h3aW5rLmNvbS5ucAAKCRAQdt5sNrKhj+3UDACh/D3SmBo0gXG/8klqAdTklpTI
CLCXzQzc34o/cqm8R23CCS1Kx7kO/pAc/OUNBwuTXb9kaP+CN+oc1fSg0SEIU96k
kLdro5y2Dcu8t7/T42MtS0IO+2kXI51ucP4Er/doQ6xDpy056vL2B8ETVtmM8j9e
Wzvg1VuHuLS3BkCHPDODhNGctMaPmOByrqZvrd7rcTM+zCAmLHHHLephV5H8DoRe
x0LjGULN7urdW1SNzpF9V0LBdumNB1OCVfyCaILBoLlVY8w60CygQSbHl8oMiPCt
go1XPpvJ5qfixbrUNoh/popMUI287j/K86dIaDB22F16sMPtt+f2e7eSIcxP6QCh
FkD1k2PP6JuolrwTbGkPEHL5sjP7ezGkLYt6GqdZZLT1j0XgQdT5nOzRGa7kxxgg
pOGcRy+CrD4FGcs+ZMWIm49cs2lqD5vJ6rxv37ZORb8LSFkj0DxBZ0kwL65P75uD
lCMrUPIhoAEvSLMRpQV5ZwyTuRHx9t1F5lHzP0U=
=rI7L
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 15 Dec 2021 18:25:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 15 13:25:26 2021
Received: from localhost ([127.0.0.1]:33680 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mxYxx-0005Q0-VO
	for submit <at> debbugs.gnu.org; Wed, 15 Dec 2021 13:25:26 -0500
Received: from forward102j.mail.yandex.net ([5.45.198.243]:46776)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ashwin@HIDDEN>) id 1mxYxw-0005Pk-4Y
 for 52507 <at> debbugs.gnu.org; Wed, 15 Dec 2021 13:25:25 -0500
Received: from myt5-b88997415fa8.qloud-c.yandex.net
 (myt5-b88997415fa8.qloud-c.yandex.net
 [IPv6:2a02:6b8:c12:1fa2:0:640:b889:9741])
 by forward102j.mail.yandex.net (Yandex) with ESMTP id D94CD4BE69E2;
 Wed, 15 Dec 2021 21:25:16 +0300 (MSK)
Received: from myt5-aad1beefab42.qloud-c.yandex.net
 (myt5-aad1beefab42.qloud-c.yandex.net [2a02:6b8:c12:128:0:640:aad1:beef])
 by myt5-b88997415fa8.qloud-c.yandex.net (mxback/Yandex) with ESMTP id
 ttzoAkXQKs-PGfSfWBk; Wed, 15 Dec 2021 21:25:16 +0300
Authentication-Results: myt5-b88997415fa8.qloud-c.yandex.net; dkim=pass
Received: by myt5-aad1beefab42.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA
 id SztCjPO7BH-PFP8YZuW; Wed, 15 Dec 2021 21:25:15 +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: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <86a6h13j4i.fsf@HIDDEN> <85o85hsr3b.fsf@HIDDEN>
 <861r2dzqrj.fsf@HIDDEN>
Date: Wed, 15 Dec 2021 18:26:14 +0000
In-Reply-To: <861r2dzqrj.fsf@HIDDEN> (Juri Linkov's message of "Wed, 
 15 Dec 2021 20:06:56 +0200")
Message-ID: <85fsqt67y1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="==-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org, Ashwin Kafle <ashwin@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: multipart/mixed; boundary="=-=-="

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Juri Linkov <juri@HIDDEN> writes:

> Then another question: why backup is needed at all?
> When the file is not going to be deleted, then
> there is no need to make a backup copy?

There could be deletion or not depending on the value of keep-file.
Maybe the check for that can be made earlier and backup can be skipped
conditionally.=20=20

> The comment before calling `vc-resynch-buffer' says it's to
> make sure the buffer is deleted.  But it seems the buffer
> is already deleted at that point?

No, the buffer is not deleted at that point. I should've changed that
comment too.  vc-resynch-buffer would've deleted that buffer if the
second arg was nil.

>
> Also it looks that your another change is dangerous:
>
>  (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" "--cac=
hed" "--")))
>
> because it deletes the file in the staging area
> that is not used by vc-git, so there is no way
> to commit the deletion using vc commands.

I think this check in vc-delete-file takes care of that


--=-=-=
Content-Type: text/plain
Content-Disposition: inline

(when (eq state 'edited)
        (error "Please commit or undo your changes before deleting %s" file))

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable


=2D-=20
I'd rather just believe that it's done by little elves running around.

--=-=-=--

--==-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQHKBAEBCAA0FiEEvNoXmdYXLw2CzQ66EHbebDayoY8FAmG6M0YWHGFzaHdpbkBh
c2h3aW5rLmNvbS5ucAAKCRAQdt5sNrKhjyr+C/9g/bz3nJARmthlQDgJvgCaUBem
tg7SOlz3C9c9Up2j+RMS6NFLhnOSILBU88yUSYMeDLhA0yzn3DCzWwlpuIpZYwxm
EhTHZ6f+rc3TqMGeMavC2xkPu6U5SMsxcchNLlAQB1/tfDoJrBFAydWReTvShOEH
jxrPwaUcRvGBl+H4jtdewtcSjZVJtbM73DzmyIxsxYDt9eqjcJH/fSni4ONwYvpy
FQ0JCBs3KjT2I77xWX9RjjKrfKPOTYXR77mXORiY/ZtUpIRBNTQMhh4U9tR+N3//
hzI5gCvJFaaP7/X10W3/nUGKRp8yfHnTY6dDBMSApmAoY/es+wVT+gwFjPZeWdLO
usFfpyZ7Wp+2R/nNlRHXrbdeuntAEFIvuNIdpENb/CGrk+AIA/3u0N5vG7yQJwxW
ClfHb9NOpBnLooAa/5am1Tf+wfgwThR1aKY+swbl0yddpbUNNesW7TDhVDBmyvB1
lYjNBaO453i5Fsw92cYl9jHzZfJI6UcHD1c9L9Q=
=YU/H
-----END PGP SIGNATURE-----
--==-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 15 Dec 2021 18:09:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 15 13:09:05 2021
Received: from localhost ([127.0.0.1]:33648 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mxYi9-00050y-J1
	for submit <at> debbugs.gnu.org; Wed, 15 Dec 2021 13:09:05 -0500
Received: from relay1-d.mail.gandi.net ([217.70.183.193]:53893)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1mxYi7-00050S-TP
 for 52507 <at> debbugs.gnu.org; Wed, 15 Dec 2021 13:09:04 -0500
Received: (Authenticated sender: juri@HIDDEN)
 by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 45596240009;
 Wed, 15 Dec 2021 18:08:54 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Ashwin Kafle <ashwin@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
Organization: LINKOV.NET
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <86a6h13j4i.fsf@HIDDEN> <85o85hsr3b.fsf@HIDDEN>
Date: Wed, 15 Dec 2021 20:06:56 +0200
In-Reply-To: <85o85hsr3b.fsf@HIDDEN> (Ashwin Kafle's message of "Wed, 
 15 Dec 2021 17:41:44 +0000")
Message-ID: <861r2dzqrj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org
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.7 (-)

>>> +	(let ((backup-inhibited nil)
>>> + ;; if you don't set this, then for some reason, the file is never brought back
>>> +              (backup-by-copying t))
>>
>> I remember having the same problem while improving `vc-rename-file'.
>> To solve the problem, it required adding `vc-file-clearprops'.
>> Maybe it could here as well?
>
> There was a call to vc-file-clearprops later. I moved that earlier
> before backup and that didn't seem to work.

Then another question: why backup is needed at all?
When the file is not going to be deleted, then
there is no need to make a backup copy?

>>> -    (vc-resynch-buffer file nil t)))
>>> +    (vc-resynch-buffer file keep-file t)))
>>
>> It seems vc-resynch-window already uses `vc-file-clearprops'
>> when `keep-file' is specified, but also on some more conditions.
>
> I'm sorry, but I didn't really understand the above. I don't really know
> elisp to be honest.

The comment before calling `vc-resynch-buffer' says it's to
make sure the buffer is deleted.  But it seems the buffer
is already deleted at that point?

Also it looks that your another change is dangerous:

 (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" "--")))

because it deletes the file in the staging area
that is not used by vc-git, so there is no way
to commit the deletion using vc commands.

Generally, you have a good idea, but it needs more careful handling
with the existing vc commands.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 15 Dec 2021 17:40:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 15 12:40:56 2021
Received: from localhost ([127.0.0.1]:33598 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mxYGu-0004HT-GR
	for submit <at> debbugs.gnu.org; Wed, 15 Dec 2021 12:40:56 -0500
Received: from forward101o.mail.yandex.net ([37.140.190.181]:59828)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ashwin@HIDDEN>) id 1mxYGr-0004HD-4i
 for 52507 <at> debbugs.gnu.org; Wed, 15 Dec 2021 12:40:55 -0500
Received: from myt6-0d043a4812e9.qloud-c.yandex.net
 (myt6-0d043a4812e9.qloud-c.yandex.net
 [IPv6:2a02:6b8:c12:212b:0:640:d04:3a48])
 by forward101o.mail.yandex.net (Yandex) with ESMTP id D885E369C5EA;
 Wed, 15 Dec 2021 20:40:45 +0300 (MSK)
Received: from myt6-016ca1315a73.qloud-c.yandex.net
 (myt6-016ca1315a73.qloud-c.yandex.net [2a02:6b8:c12:4e0e:0:640:16c:a131])
 by myt6-0d043a4812e9.qloud-c.yandex.net (mxback/Yandex) with ESMTP id
 mNGCpOPYoa-ejfWMPgJ; Wed, 15 Dec 2021 20:40:45 +0300
Authentication-Results: myt6-0d043a4812e9.qloud-c.yandex.net; dkim=pass
Received: by myt6-016ca1315a73.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA
 id ZaYSoCh79f-eiSmw10Q; Wed, 15 Dec 2021 20:40:44 +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: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
References: <20211215095324.18195-1-ashwin@HIDDEN>
 <86a6h13j4i.fsf@HIDDEN>
Date: Wed, 15 Dec 2021 17:41:44 +0000
In-Reply-To: <86a6h13j4i.fsf@HIDDEN> (Juri Linkov's message of "Wed, 
 15 Dec 2021 18:53:01 +0200")
Message-ID: <85o85hsr3b.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.7 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org, Ashwin Kafle <ashwin@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.7 (-)

Juri Linkov <juri@HIDDEN> writes:

>> -  (interactive (list (read-file-name "VC delete file: " nil
>> -                                     (when (vc-backend buffer-file-name)
>> -                                       buffer-file-name)
>> -                                     t)))
>> +  (interactive "f\nP")
>
> I wonder why no prompt?  You can add `current-prefix-arg' to the
> interactive list to keep the existing prompt.

Thanks, I didn't knew about that. 

>
>> +	(let ((backup-inhibited nil)
>> + ;; if you don't set this, then for some reason, the file is never
>> brought back
>> +              (backup-by-copying t))
>
> I remember having the same problem while improving `vc-rename-file'.
> To solve the problem, it required adding `vc-file-clearprops'.
> Maybe it could here as well?

There was a call to vc-file-clearprops later. I moved that earlier
before backup and that didn't seem to work. 

>
>> -    (vc-resynch-buffer file nil t)))
>> +    (vc-resynch-buffer file keep-file t)))
>
> It seems vc-resynch-window already uses `vc-file-clearprops'
> when `keep-file' is specified, but also on some more conditions.

I'm sorry, but I didn't really understand the above. I don't really know
elisp to be honest.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.
Forcibly Merged 52507 52508. Request was from Juri Linkov <juri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 52507 <at> debbugs.gnu.org:


Received: (at 52507) by debbugs.gnu.org; 15 Dec 2021 16:55:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 15 11:55:43 2021
Received: from localhost ([127.0.0.1]:33570 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mxXZ8-0000ud-SY
	for submit <at> debbugs.gnu.org; Wed, 15 Dec 2021 11:55:43 -0500
Received: from relay11.mail.gandi.net ([217.70.178.231]:36077)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>)
 id 1mxXZ6-0000uG-1m; Wed, 15 Dec 2021 11:55:40 -0500
Received: (Authenticated sender: juri@HIDDEN)
 by relay11.mail.gandi.net (Postfix) with ESMTPSA id 522F2100015;
 Wed, 15 Dec 2021 16:55:30 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Ashwin Kafle <ashwin@HIDDEN>
Subject: Re: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
Organization: LINKOV.NET
References: <20211215095324.18195-1-ashwin@HIDDEN>
Date: Wed, 15 Dec 2021 18:53:01 +0200
In-Reply-To: <20211215095324.18195-1-ashwin@HIDDEN> (Ashwin Kafle's
 message of "Wed, 15 Dec 2021 15:38:24 +0545")
Message-ID: <86a6h13j4i.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 52507
Cc: 52507 <at> debbugs.gnu.org
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.7 (-)

forcemerge 52507 52508
thanks

> -  (interactive (list (read-file-name "VC delete file: " nil
> -                                     (when (vc-backend buffer-file-name)
> -                                       buffer-file-name)
> -                                     t)))
> +  (interactive "f\nP")

I wonder why no prompt?  You can add `current-prefix-arg' to the
interactive list to keep the existing prompt.

> +	(let ((backup-inhibited nil)
> +              ;; if you don't set this, then for some reason, the file is never brought back
> +              (backup-by-copying t))

I remember having the same problem while improving `vc-rename-file'.
To solve the problem, it required adding `vc-file-clearprops'.
Maybe it could here as well?

> -    (vc-resynch-buffer file nil t)))
> +    (vc-resynch-buffer file keep-file t)))

It seems vc-resynch-window already uses `vc-file-clearprops'
when `keep-file' is specified, but also on some more conditions.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 15 Dec 2021 12:55:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 15 07:55:21 2021
Received: from localhost ([127.0.0.1]:60439 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mxToW-0006ey-5k
	for submit <at> debbugs.gnu.org; Wed, 15 Dec 2021 07:55:21 -0500
Received: from lists.gnu.org ([209.51.188.17]:55346)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <birdsite@HIDDEN>) id 1mxQy7-00082i-J2
 for submit <at> debbugs.gnu.org; Wed, 15 Dec 2021 04:53:03 -0500
Received: from eggs.gnu.org ([209.51.188.92]:56468)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <birdsite@HIDDEN>)
 id 1mxQy7-0000xk-BA
 for bug-gnu-emacs@HIDDEN; Wed, 15 Dec 2021 04:53:03 -0500
Received: from mail.cock.li ([37.120.193.124]:35494)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <birdsite@HIDDEN>)
 id 1mxQy4-0004zK-Nh
 for bug-gnu-emacs@HIDDEN; Wed, 15 Dec 2021 04:53:02 -0500
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 15:38:24 +0545
Message-Id: <20211215095324.18195-1-ashwin@HIDDEN>
X-Mailer: git-send-email 2.34.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=37.120.193.124; envelope-from=birdsite@HIDDEN;
 helo=mail.cock.li
X-Spam_score_int: -16
X-Spam_score: -1.7
X-Spam_bar: -
X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9,
 HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.1 (-)
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.1 (--)

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.
---
I've already signed the copyright papers.

 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





Acknowledgement sent to Ashwin Kafle <ashwin@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#52507; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 26 Dec 2021 18:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.