* bug#52508: [PATCH] Option for vc-delete-file to keep file on disk
@ 2021-12-15 10:23 Ashwin Kafle
2021-12-15 14:14 ` Eli Zaretskii
2021-12-18 4:41 ` Richard Stallman
0 siblings, 2 replies; 8+ messages in thread
From: Ashwin Kafle @ 2021-12-15 10:23 UTC (permalink / raw)
To: 52508; +Cc: Ashwin Kafle, Dmitry Gutov
[-- Attachment #1: Type: text/plain, Size: 185 bytes --]
Hello,
I've created the attached patch to have vc-delete file to keep files on
disk using a prefix argument. I've only tested it for vc-git.
I've already signed the copyright papers.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Option-for-vc-delete-file-to-keep-file-on-disk.patch --]
[-- Type: text/x-diff, Size: 4801 bytes --]
From 8bfbc34afa760c4d526fa15d8dddc78f2be78a81 Mon Sep 17 00:00:00 2001
From: Ashwin Kafle <ashwin@ashwink.com.np>
Date: Wed, 15 Dec 2021 15:25:04 +0545
Subject: [PATCH] Option for vc-delete-file to keep file on disk
Add a prefix argument on vc-delete-file to keep affected
file on disk and keep the current buffer intact. This option
relies on the backends to not delete files themselves.
* doc/emacs/vc1-xtra.texi: Document the change.
* lisp/vc/vc-git.el: Make git leave files on disk.
* lisp/vc/vc.el: Change vc-delete-file to accept optional prefix argument.
---
doc/emacs/vc1-xtra.texi | 3 ++-
etc/NEWS | 4 ++++
lisp/vc/vc-git.el | 4 ++--
lisp/vc/vc.el | 20 +++++++++++---------
4 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/doc/emacs/vc1-xtra.texi b/doc/emacs/vc1-xtra.texi
index 4cd00cba6c..2cf69583b3 100644
--- a/doc/emacs/vc1-xtra.texi
+++ b/doc/emacs/vc1-xtra.texi
@@ -122,7 +122,8 @@ VC Delete/Rename
If you wish to delete a version-controlled file, use the command
@kbd{M-x vc-delete-file}. This prompts for the file name, and deletes
it via the version control system. The file is removed from the
-working tree, and in the VC Directory buffer
+working tree, and in the VC Directory buffer. If you give a prefix argument,
+the file is not deleted from disk.
@iftex
(@pxref{VC Directory Mode,,, emacs, the Emacs Manual}),
@end iftex
diff --git a/etc/NEWS b/etc/NEWS
index 8d83b2a7e3..2469060a3d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -372,6 +372,10 @@ info node. This command only works for the Emacs and Emacs Lisp manuals.
** vc
+*** 'C-x v x' accepts a prefix argument to keep file on disk
+Previously 'C-x v x' always deleted the selected file. Now if you give it
+prefix argument, it will keep the buffer and file on disk intact.
+Currently this is only implemented for vc-git.
---
*** 'C-x v v' on an unregistered file will now use the most specific backend.
Previously, if you had an SVN-covered "~/" directory, and a Git-covered
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 5c6a39aec9..69ef216529 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1569,8 +1569,8 @@ vc-git-next-revision
(or (vc-git-symbolic-commit next-rev) next-rev)))
(defun vc-git-delete-file (file)
- (vc-git-command nil 0 (vc-git--literal-pathspec file) "rm" "-f" "--"))
-
+ (vc-git-command nil 0 (vc-git--literal-pathspec file) "rm" "-f" "--cached" "--"))
+)
(defun vc-git-rename-file (old new)
(vc-git-command nil 0 (list old new) "mv" "-f" "--"))
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 64f752f248..43fc0e787e 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2970,14 +2970,13 @@ vc-transfer-file
(vc-checkin file new-backend comment (stringp comment)))))
;;;###autoload
-(defun vc-delete-file (file)
+(defun vc-delete-file (file &optional keep-file)
"Delete file and mark it as such in the version control system.
If called interactively, read FILE, defaulting to the current
-buffer's file name if it's under version control."
- (interactive (list (read-file-name "VC delete file: " nil
- (when (vc-backend buffer-file-name)
- buffer-file-name)
- t)))
+buffer's file name if it's under version control.
+If a prefix argument is given (optional argument KEEP-FILE) then
+don't delete the file from the disk"
+ (interactive "f\nP")
(setq file (expand-file-name file))
(let ((buf (get-file-buffer file))
(backend (vc-backend file)))
@@ -2999,19 +2998,22 @@ vc-delete-file
(unless (or (file-directory-p file) (null make-backup-files)
(not (file-exists-p file)))
(with-current-buffer (or buf (find-file-noselect file))
- (let ((backup-inhibited nil))
+ (let ((backup-inhibited nil)
+ ;; if you don't set this, then for some reason, the file is never brought back
+ (backup-by-copying t))
(backup-buffer))))
;; Bind `default-directory' so that the command that the backend
;; runs to remove the file is invoked in the correct context.
(let ((default-directory (file-name-directory file)))
(vc-call-backend backend 'delete-file file))
;; If the backend hasn't deleted the file itself, let's do it for him.
- (when (file-exists-p file) (delete-file file))
+ (when (and (file-exists-p file) (null keep-file))
+ (delete-file file))
;; Forget what VC knew about the file.
(vc-file-clearprops file)
;; Make sure the buffer is deleted and the *vc-dir* buffers are
;; updated after this.
- (vc-resynch-buffer file nil t)))
+ (vc-resynch-buffer file keep-file t)))
;;;###autoload
(defun vc-rename-file (old new)
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* bug#52508: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-15 10:23 bug#52508: [PATCH] Option for vc-delete-file to keep file on disk Ashwin Kafle
@ 2021-12-15 14:14 ` Eli Zaretskii
2021-12-15 18:07 ` Ashwin Kafle
2021-12-18 4:41 ` Richard Stallman
1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2021-12-15 14:14 UTC (permalink / raw)
To: Ashwin Kafle; +Cc: 52508, dgutov
> From: Ashwin Kafle <ashwin@ashwink.com.np>
> Date: Wed, 15 Dec 2021 10:23:42 +0000
> Cc: Ashwin Kafle <ashwin@ashwink.com.np>, Dmitry Gutov <dgutov@yandex.ru>
>
> I've created the attached patch to have vc-delete file to keep files on
> disk using a prefix argument. I've only tested it for vc-git.
Thanks, sounds useful.
A few minor comments below, mainly to the documentation parts:
> * doc/emacs/vc1-xtra.texi: Document the change.
> * lisp/vc/vc-git.el: Make git leave files on disk.
> * lisp/vc/vc.el: Change vc-delete-file to accept optional prefix argument.
Our conventions are to use the ChangeLog style of these entries, which
means they should state the function names where the changes are made,
not just the file names.
> --- a/doc/emacs/vc1-xtra.texi
> +++ b/doc/emacs/vc1-xtra.texi
> @@ -122,7 +122,8 @@ VC Delete/Rename
> If you wish to delete a version-controlled file, use the command
> @kbd{M-x vc-delete-file}. This prompts for the file name, and deletes
> it via the version control system. The file is removed from the
> -working tree, and in the VC Directory buffer
> +working tree, and in the VC Directory buffer. If you give a prefix argument,
^^
We leave 2 spaces between sentences, per US English conventions.
> +*** 'C-x v x' accepts a prefix argument to keep file on disk
Period at the end of the heading, please.
> +Previously 'C-x v x' always deleted the selected file. Now if you give it
> +prefix argument, it will keep the buffer and file on disk intact.
Two spaces between sentences.
> -(defun vc-delete-file (file)
> +(defun vc-delete-file (file &optional keep-file)
> "Delete file and mark it as such in the version control system.
> If called interactively, read FILE, defaulting to the current
> -buffer's file name if it's under version control."
> - (interactive (list (read-file-name "VC delete file: " nil
> - (when (vc-backend buffer-file-name)
> - buffer-file-name)
> - t)))
> +buffer's file name if it's under version control.
> +If a prefix argument is given (optional argument KEEP-FILE) then
> +don't delete the file from the disk"
Period missing at the end of the last sentence.
> - (let ((backup-inhibited nil))
> + (let ((backup-inhibited nil)
> + ;; if you don't set this, then for some reason, the file is never brought back
> + (backup-by-copying t))
Wouldn't it be better to understand why this mystery happens?
Also, please start the comment with a capital letter and end it with a
period.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52508: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-15 14:14 ` Eli Zaretskii
@ 2021-12-15 18:07 ` Ashwin Kafle
0 siblings, 0 replies; 8+ messages in thread
From: Ashwin Kafle @ 2021-12-15 18:07 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Ashwin Kafle, 52508, dgutov
[-- Attachment #1: Type: text/plain, Size: 957 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
[...]
>> I've created the attached patch to have vc-delete file to keep files on
>> disk using a prefix argument. I've only tested it for vc-git.
>
> Thanks, sounds useful.
>
> A few minor comments below, mainly to the documentation parts:
[...]
Thanks, now fixed and attached.
>
>> - (let ((backup-inhibited nil))
>> + (let ((backup-inhibited nil)
>> + ;; if you don't set this, then for some reason, the file is never
>> brought back
>> + (backup-by-copying t))
>
> Wouldn't it be better to understand why this mystery happens?
Yeah, a backup function should bring back the original file. That is
indeed weird. But I can't read much elisp yet to be of help in here.
In this case, backup-by-copying seems to be the better method for
backups since the intention is to not touch the original files at all.
Reading the docstring of backup-buffer, backup-by-rename doesn't look
fit for this use case.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Option-for-vc-delete-file-to-keep-file-on-disk.patch --]
[-- Type: text/x-diff, Size: 4902 bytes --]
From b8e5b8463f15a53e5fb6ddac5447005d4133606b Mon Sep 17 00:00:00 2001
From: Ashwin Kafle <ashwin@ashwink.com.np>
Date: Wed, 15 Dec 2021 23:49:47 +0545
Subject: [PATCH] Option for vc-delete-file to keep file on disk
Add a prefix argument on vc-delete-file to keep affected
file on disk and keep the current buffer intact. This option
relies on the backends to not delete files themselves.
* doc/emacs/vc1-xtra.texi: Document the change.
* lisp/vc/vc-git.el (vc-git-delete-file): Make git leave files on disk.
* lisp/vc/vc.el (vc-delete-file): Change vc-delete-file to accept
optional prefix argument.
---
doc/emacs/vc1-xtra.texi | 3 ++-
etc/NEWS | 4 ++++
lisp/vc/vc-git.el | 4 ++--
lisp/vc/vc.el | 18 ++++++++++++------
4 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/doc/emacs/vc1-xtra.texi b/doc/emacs/vc1-xtra.texi
index 4cd00cba6c..99e5eef7c1 100644
--- a/doc/emacs/vc1-xtra.texi
+++ b/doc/emacs/vc1-xtra.texi
@@ -122,7 +122,8 @@ VC Delete/Rename
If you wish to delete a version-controlled file, use the command
@kbd{M-x vc-delete-file}. This prompts for the file name, and deletes
it via the version control system. The file is removed from the
-working tree, and in the VC Directory buffer
+working tree, and in the VC Directory buffer. If you give a prefix argument,
+the file is not deleted from disk.
@iftex
(@pxref{VC Directory Mode,,, emacs, the Emacs Manual}),
@end iftex
diff --git a/etc/NEWS b/etc/NEWS
index 8d83b2a7e3..af358aaedb 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -372,6 +372,10 @@ info node. This command only works for the Emacs and Emacs Lisp manuals.
** vc
+*** 'C-x v x' accepts a prefix argument to keep file on disk.
+Previously 'C-x v x' always deleted the selected file. Now if you give it
+prefix argument, it will keep the buffer and file on disk intact.
+Currently this is only implemented for vc-git.
---
*** 'C-x v v' on an unregistered file will now use the most specific backend.
Previously, if you had an SVN-covered "~/" directory, and a Git-covered
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 5c6a39aec9..69ef216529 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1569,8 +1569,8 @@ vc-git-next-revision
(or (vc-git-symbolic-commit next-rev) next-rev)))
(defun vc-git-delete-file (file)
- (vc-git-command nil 0 (vc-git--literal-pathspec file) "rm" "-f" "--"))
-
+ (vc-git-command nil 0 (vc-git--literal-pathspec file) "rm" "-f" "--cached" "--"))
+)
(defun vc-git-rename-file (old new)
(vc-git-command nil 0 (list old new) "mv" "-f" "--"))
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 64f752f248..a4d390fea8 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2970,14 +2970,17 @@ vc-transfer-file
(vc-checkin file new-backend comment (stringp comment)))))
;;;###autoload
-(defun vc-delete-file (file)
+(defun vc-delete-file (file &optional keep-file)
"Delete file and mark it as such in the version control system.
If called interactively, read FILE, defaulting to the current
-buffer's file name if it's under version control."
+buffer's file name if it's under version control.
+If a prefix argument is given (optional argument KEEP-FILE) then
+don't delete the file from the disk."
(interactive (list (read-file-name "VC delete file: " nil
(when (vc-backend buffer-file-name)
buffer-file-name)
- t)))
+ t)
+ current-prefix-arg))
(setq file (expand-file-name file))
(let ((buf (get-file-buffer file))
(backend (vc-backend file)))
@@ -2999,19 +3002,22 @@ vc-delete-file
(unless (or (file-directory-p file) (null make-backup-files)
(not (file-exists-p file)))
(with-current-buffer (or buf (find-file-noselect file))
- (let ((backup-inhibited nil))
+ (let ((backup-inhibited nil)
+ ;; If you don't set this, then for some reason, the file is never brought back.
+ (backup-by-copying t))
(backup-buffer))))
;; Bind `default-directory' so that the command that the backend
;; runs to remove the file is invoked in the correct context.
(let ((default-directory (file-name-directory file)))
(vc-call-backend backend 'delete-file file))
;; If the backend hasn't deleted the file itself, let's do it for him.
- (when (file-exists-p file) (delete-file file))
+ (when (and (file-exists-p file) (null keep-file))
+ (delete-file file))
;; Forget what VC knew about the file.
(vc-file-clearprops file)
;; Make sure the buffer is deleted and the *vc-dir* buffers are
;; updated after this.
- (vc-resynch-buffer file nil t)))
+ (vc-resynch-buffer file keep-file t)))
;;;###autoload
(defun vc-rename-file (old new)
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* bug#52508: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-15 10:23 bug#52508: [PATCH] Option for vc-delete-file to keep file on disk Ashwin Kafle
2021-12-15 14:14 ` Eli Zaretskii
@ 2021-12-18 4:41 ` Richard Stallman
2021-12-18 7:07 ` Eli Zaretskii
2021-12-18 7:36 ` Ashwin Kafle
1 sibling, 2 replies; 8+ messages in thread
From: Richard Stallman @ 2021-12-18 4:41 UTC (permalink / raw)
To: Ashwin Kafle; +Cc: ashwin, 52508, dgutov
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> I've created the attached patch to have vc-delete file to keep files on
> disk using a prefix argument. I've only tested it for vc-git.
This may seem shocking, but what about changing vc-delete-file
to ALWAYS preserve the local file? In other words, to change ONLY the repo?
That's the operation that vc-delete-file is necessary for.
If you do in fact want to delete the local file as well, that's easy to do.
This would have the advantage of one less switch to remember.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52508: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-18 4:41 ` Richard Stallman
@ 2021-12-18 7:07 ` Eli Zaretskii
2021-12-18 7:36 ` Ashwin Kafle
1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2021-12-18 7:07 UTC (permalink / raw)
To: rms; +Cc: ashwin, 52508, dgutov
> From: Richard Stallman <rms@gnu.org>
> Date: Fri, 17 Dec 2021 23:41:15 -0500
> Cc: ashwin@ashwink.com.np, 52508@debbugs.gnu.org, dgutov@yandex.ru
>
> > I've created the attached patch to have vc-delete file to keep files on
> > disk using a prefix argument. I've only tested it for vc-git.
>
> This may seem shocking, but what about changing vc-delete-file
> to ALWAYS preserve the local file? In other words, to change ONLY the repo?
I think it would be unexpected. VCS deletion usually means you delete
both the file on the local disk and tell the VCS to delete it from the
repository.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52508: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-18 4:41 ` Richard Stallman
2021-12-18 7:07 ` Eli Zaretskii
@ 2021-12-18 7:36 ` Ashwin Kafle
2021-12-20 4:42 ` Richard Stallman
1 sibling, 1 reply; 8+ messages in thread
From: Ashwin Kafle @ 2021-12-18 7:36 UTC (permalink / raw)
To: Richard Stallman; +Cc: Ashwin Kafle, 52508, dgutov
Richard Stallman <rms@gnu.org> writes:
> [[[ To any NSA and FBI agents reading my email: please consider ]]]
> [[[ whether defending the US Constitution against all enemies, ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
> > I've created the attached patch to have vc-delete file to keep files on
> > disk using a prefix argument. I've only tested it for vc-git.
>
> This may seem shocking, but what about changing vc-delete-file
> to ALWAYS preserve the local file? In other words, to change ONLY the repo?
>
> That's the operation that vc-delete-file is necessary for.
> If you do in fact want to delete the local file as well, that's easy to do.
>
> This would have the advantage of one less switch to remember.
I had the same initial thought ;)
But, vc-delete-file is used by a lot of people and it's probably muscle
memory for them. I didn't want people to be affected much by this patch.
Also, there's a new revision of this patch under bug#52507 that will
make sure that the local file is always preserved even if the VCS itself
deletes it.
After i understand what Juri is saying, i'll likely make a
new patch removing the change from vc-git.el
Thank you, Stallman, for all the hard work you've done and continue to do.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
@ 2021-12-15 9:53 Ashwin Kafle
2021-12-15 16:53 ` Juri Linkov
0 siblings, 1 reply; 8+ messages in thread
From: Ashwin Kafle @ 2021-12-15 9:53 UTC (permalink / raw)
To: 52507; +Cc: Ashwin Kafle, Dmitry Gutov
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-15 9:53 bug#52507: " Ashwin Kafle
@ 2021-12-15 16:53 ` Juri Linkov
2021-12-15 17:41 ` Ashwin Kafle
0 siblings, 1 reply; 8+ messages in thread
From: Juri Linkov @ 2021-12-15 16:53 UTC (permalink / raw)
To: Ashwin Kafle; +Cc: 52507
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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-15 16:53 ` Juri Linkov
@ 2021-12-15 17:41 ` Ashwin Kafle
2021-12-15 18:06 ` Juri Linkov
0 siblings, 1 reply; 8+ messages in thread
From: Ashwin Kafle @ 2021-12-15 17:41 UTC (permalink / raw)
To: Juri Linkov; +Cc: 52507, Ashwin Kafle
Juri Linkov <juri@linkov.net> 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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-15 17:41 ` Ashwin Kafle
@ 2021-12-15 18:06 ` Juri Linkov
2021-12-15 18:26 ` Ashwin Kafle
0 siblings, 1 reply; 8+ messages in thread
From: Juri Linkov @ 2021-12-15 18:06 UTC (permalink / raw)
To: Ashwin Kafle; +Cc: 52507
>>> + (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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-15 18:06 ` Juri Linkov
@ 2021-12-15 18:26 ` Ashwin Kafle
2021-12-15 18:34 ` Ashwin Kafle
0 siblings, 1 reply; 8+ messages in thread
From: Ashwin Kafle @ 2021-12-15 18:26 UTC (permalink / raw)
To: Juri Linkov; +Cc: 52507, Ashwin Kafle
[-- Attachment #1.1: Type: text/plain, Size: 1153 bytes --]
Juri Linkov <juri@linkov.net> 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.
> 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" "--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.
I think this check in vc-delete-file takes care of that
[-- Attachment #1.2: Type: text/plain, Size: 103 bytes --]
(when (eq state 'edited)
(error "Please commit or undo your changes before deleting %s" file))
[-- Attachment #1.3: Type: text/plain, Size: 79 bytes --]
--
I'd rather just believe that it's done by little elves running around.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 690 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-15 18:26 ` Ashwin Kafle
@ 2021-12-15 18:34 ` Ashwin Kafle
2021-12-16 17:01 ` Juri Linkov
0 siblings, 1 reply; 8+ messages in thread
From: Ashwin Kafle @ 2021-12-15 18:34 UTC (permalink / raw)
To: Ashwin Kafle; +Cc: 52507, Juri Linkov
[-- Attachment #1: Type: text/plain, Size: 782 bytes --]
Ashwin Kafle <ashwin@ashwink.com.np> 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" "--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.
>
> 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" file))
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?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 690 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-15 18:34 ` Ashwin Kafle
@ 2021-12-16 17:01 ` Juri Linkov
2021-12-26 14:23 ` Ashwin Kafle
0 siblings, 1 reply; 8+ messages in thread
From: Juri Linkov @ 2021-12-16 17:01 UTC (permalink / raw)
To: Ashwin Kafle; +Cc: 52507
>>> (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?
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-16 17:01 ` Juri Linkov
@ 2021-12-26 14:23 ` Ashwin Kafle
2021-12-26 15:38 ` Dmitry Gutov
0 siblings, 1 reply; 8+ messages in thread
From: Ashwin Kafle @ 2021-12-26 14:23 UTC (permalink / raw)
To: Juri Linkov; +Cc: 52507, Ashwin Kafle
Juri Linkov <juri@linkov.net> 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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-26 14:23 ` Ashwin Kafle
@ 2021-12-26 15:38 ` Dmitry Gutov
2021-12-26 15:51 ` Ashwin Kafle
0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Gutov @ 2021-12-26 15:38 UTC (permalink / raw)
To: Ashwin Kafle, Juri Linkov; +Cc: 52507
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?
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-26 15:38 ` Dmitry Gutov
@ 2021-12-26 15:51 ` Ashwin Kafle
2021-12-26 15:57 ` Dmitry Gutov
0 siblings, 1 reply; 8+ messages in thread
From: Ashwin Kafle @ 2021-12-26 15:51 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 52507, Ashwin Kafle, Juri Linkov
Dmitry Gutov <dgutov@yandex.ru> 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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-26 15:51 ` Ashwin Kafle
@ 2021-12-26 15:57 ` Dmitry Gutov
2021-12-26 16:12 ` Ashwin Kafle
0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Gutov @ 2021-12-26 15:57 UTC (permalink / raw)
To: Ashwin Kafle; +Cc: 52507, Juri Linkov
On 26.12.2021 18:51, Ashwin Kafle wrote:
> Dmitry Gutov<dgutov@yandex.ru> 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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-26 15:57 ` Dmitry Gutov
@ 2021-12-26 16:12 ` Ashwin Kafle
2021-12-26 16:28 ` Dmitry Gutov
0 siblings, 1 reply; 8+ messages in thread
From: Ashwin Kafle @ 2021-12-26 16:12 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 52507, Ashwin Kafle, Juri Linkov
Dmitry Gutov <dgutov@yandex.ru> writes:
> On 26.12.2021 18:51, Ashwin Kafle wrote:
>> Dmitry Gutov<dgutov@yandex.ru> 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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-26 16:12 ` Ashwin Kafle
@ 2021-12-26 16:28 ` Dmitry Gutov
2021-12-26 17:03 ` Ashwin Kafle
0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Gutov @ 2021-12-26 16:28 UTC (permalink / raw)
To: Ashwin Kafle; +Cc: 52507, Juri Linkov
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).
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-26 16:28 ` Dmitry Gutov
@ 2021-12-26 17:03 ` Ashwin Kafle
2021-12-27 0:03 ` Dmitry Gutov
0 siblings, 1 reply; 8+ messages in thread
From: Ashwin Kafle @ 2021-12-26 17:03 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 52507, Ashwin Kafle, Juri Linkov
Dmitry Gutov <dgutov@yandex.ru> 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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-26 17:03 ` Ashwin Kafle
@ 2021-12-27 0:03 ` Dmitry Gutov
2021-12-27 4:08 ` Ashwin Kafle
0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Gutov @ 2021-12-27 0:03 UTC (permalink / raw)
To: Ashwin Kafle; +Cc: 52507, Juri Linkov
On 26.12.2021 20:03, Ashwin Kafle wrote:
> Dmitry Gutov <dgutov@yandex.ru> 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)
OK, that seems to make sense. But how would we convey to the user that
that "removed" (followed by "unregistered") refers to the staging area?
Patch which would implement this in VC-Dir/Git is welcome.
And the next step would be to ensure that such deletions (which keep the
file on disk) can be committed by vc-next-action.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-27 0:03 ` Dmitry Gutov
@ 2021-12-27 4:08 ` Ashwin Kafle
2021-12-28 0:53 ` Dmitry Gutov
0 siblings, 1 reply; 8+ messages in thread
From: Ashwin Kafle @ 2021-12-27 4:08 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 52507, Ashwin Kafle, Juri Linkov
Dmitry Gutov <dgutov@yandex.ru> writes:
>>> 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)
>
> OK, that seems to make sense. But how would we convey to the user that
> that "removed" (followed by "unregistered") refers to the staging
> area?
>
By mentioning it in the manual or perhaps in the docstring of
vc-delete-file? It should be intuitive enough once you do it.
>
> Patch which would implement this in VC-Dir/Git is welcome.
Can you please explain to me briefly how vc-dir gets this info? I will
try at it but if you don't hear from me in a week then you know what
happened ;-)
On a related note, how do you test patches? Last time i had to manually
C-M-x each and every function that was changed. Is there a way to tell
emacs to ignore byte compiled files so as a simple restart will apply
new changes? Any other way is okay with me too.
>
> And the next step would be to ensure that such deletions (which keep
> the file on disk) can be committed by vc-next-action.
>
If it shows the two files, then you can mark the one saying removed and
vc-next-action can commit it.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52507: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-27 4:08 ` Ashwin Kafle
@ 2021-12-28 0:53 ` Dmitry Gutov
2022-09-08 14:17 ` bug#52508: " Lars Ingebrigtsen
0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Gutov @ 2021-12-28 0:53 UTC (permalink / raw)
To: Ashwin Kafle; +Cc: 52507, Juri Linkov
On 27.12.2021 07:08, Ashwin Kafle wrote:
> Dmitry Gutov <dgutov@yandex.ru> writes:
>>>> 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)
>>
>> OK, that seems to make sense. But how would we convey to the user that
>> that "removed" (followed by "unregistered") refers to the staging
>> area?
>>
>
> By mentioning it in the manual or perhaps in the docstring of
> vc-delete-file? It should be intuitive enough once you do it.
Ideally the user interface would convey that information without
requiring the user to read the manual.
>> Patch which would implement this in VC-Dir/Git is welcome.
>
> Can you please explain to me briefly how vc-dir gets this info? I will
> try at it but if you don't hear from me in a week then you know what
> happened ;-)
It's fairly involved. There is the vc-git-dir-status-files which fetches
the status information asynchronously. But it is also updates for the
individual files when a buffer is saved, if a VC-Dir buffer is already
open (then the status comes from vc-git-state).
There is also vc-git-dir-printer which renders individual entries.
And finally, there is the ewoc.el package which stores the information
about the statuses of files which are displayed inside the VC-Dir
buffer. One should probably verify that it can show different statuses
for one file name (might be non-trivial to change, or not).
> On a related note, how do you test patches? Last time i had to manually
> C-M-x each and every function that was changed.
I either use 'M-x eval-buffer' (bound to a key, 'C-c v' in my config) to
re-evaluate the whole buffer which contains the changed code, or in some
other cases I run 'make' in the checkout which updates the .elc files,
and then restart Emacs (or rather launch a second instance for testing,
while keeping the first one running for editing).
> Is there a way to tell
> emacs to ignore byte compiled files so as a simple restart will apply
> new changes?
(setq load-prefer-newer t)
should tell Emacs to do exactly that. Though I suppose this will depend
on the order the packages are loaded -- if the edited file is loaded
before the part of your init script where this line resides, or -- even
worse -- is preloaded, this won't have the desired effect.
But otherwise this setting is very handy, and I recommend people turn it
on. Especially when developing their own packages.
>> And the next step would be to ensure that such deletions (which keep
>> the file on disk) can be committed by vc-next-action.
>>
>
> If it shows the two files, then you can mark the one saying removed and
> vc-next-action can commit it.
I mean verify that this actually works. As a UI, it sounds workable.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#52508: [PATCH] Option for vc-delete-file to keep file on disk
2021-12-28 0:53 ` Dmitry Gutov
@ 2022-09-08 14:17 ` Lars Ingebrigtsen
0 siblings, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-09-08 14:17 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 52507, Ashwin Kafle, 52508, Juri Linkov
Reading this bug report, it's unclear what the conclusion is. I agree
that it would be useful to have a command to remove a file from the VC
without deleting it. But I don't think the proposed implementation is
safe, because it only works with git -- and in other VCs, doing `C-u M-x
vc-delete-file' would continue to delete the file, contrary to what the
doc string says.
Dmitry suggested to alter the interface, but that makes for awkward
compatibility.
Perhaps this should be a new command instead? That'd be less confusing,
I think. `M-x vc-remove-file', for instance.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-09-08 14:17 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-15 10:23 bug#52508: [PATCH] Option for vc-delete-file to keep file on disk Ashwin Kafle
2021-12-15 14:14 ` Eli Zaretskii
2021-12-15 18:07 ` Ashwin Kafle
2021-12-18 4:41 ` Richard Stallman
2021-12-18 7:07 ` Eli Zaretskii
2021-12-18 7:36 ` Ashwin Kafle
2021-12-20 4:42 ` Richard Stallman
-- strict thread matches above, loose matches on Subject: below --
2021-12-15 9:53 bug#52507: " Ashwin Kafle
2021-12-15 16:53 ` Juri Linkov
2021-12-15 17:41 ` Ashwin Kafle
2021-12-15 18:06 ` Juri Linkov
2021-12-15 18:26 ` Ashwin Kafle
2021-12-15 18:34 ` Ashwin Kafle
2021-12-16 17:01 ` Juri Linkov
2021-12-26 14:23 ` Ashwin Kafle
2021-12-26 15:38 ` Dmitry Gutov
2021-12-26 15:51 ` Ashwin Kafle
2021-12-26 15:57 ` Dmitry Gutov
2021-12-26 16:12 ` Ashwin Kafle
2021-12-26 16:28 ` Dmitry Gutov
2021-12-26 17:03 ` Ashwin Kafle
2021-12-27 0:03 ` Dmitry Gutov
2021-12-27 4:08 ` Ashwin Kafle
2021-12-28 0:53 ` Dmitry Gutov
2022-09-08 14:17 ` bug#52508: " Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.