bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Juri Linkov
Subject: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
Date: Wed, 15 Dec 2021 20:06:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>>> +   (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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]