aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-07-13 06:10:29 +0200
committerLars Ingebrigtsen2019-07-13 06:10:29 +0200
commita3509a71c0a11ce3cfa6eb96c6452bff68fc5bd9 (patch)
tree15d5542f702d83b3438d236489f5f6698e4e3d4d
parente04f7c62fc363bf0434b748b4eff2f21f2a65838 (diff)
downloademacs-a3509a71c0a11ce3cfa6eb96c6452bff68fc5bd9.tar.gz
emacs-a3509a71c0a11ce3cfa6eb96c6452bff68fc5bd9.zip
Add a new command in vc-dir mode to delete files
* doc/emacs/maintaining.texi (VC Directory Commands): Document it. * lisp/vc/vc-dir.el (vc-dir-delete-files-no-vc): New command and keystroke (bug#31732).
-rw-r--r--doc/emacs/maintaining.texi9
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/vc/vc-dir.el19
3 files changed, 31 insertions, 2 deletions
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 4986c111030..42ea4d3254d 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1349,7 +1349,14 @@ Prompt for the name of a branch and display the change history of that
1349branch (@code{vc-print-branch-log}). 1349branch (@code{vc-print-branch-log}).
1350 1350
1351@item B s 1351@item B s
1352Switch to a branch (@code{vc-retrieve-tag}). @xref{Switching Branches}. 1352Switch to a branch (@code{vc-retrieve-tag}). @xref{Switching
1353Branches}.
1354
1355@item d
1356Delete the marked files, or the current file if no marks
1357(@code{vc-dir-delete-files-no-vc)}. The files will not be marked as
1358deleted in the version control system, so this function is mostly
1359useful for unregistered files.
1353@end table 1360@end table
1354 1361
1355@cindex stashes in version control 1362@cindex stashes in version control
diff --git a/etc/NEWS b/etc/NEWS
index 902203f0c33..7ff2b42bdab 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -690,6 +690,11 @@ to Hg revert.
690print diffs and logs between the merge base (common ancestor) of two 690print diffs and logs between the merge base (common ancestor) of two
691given revisions. 691given revisions.
692 692
693*** The new `d' command (`vc-dir-delete-files-no-vc') in `vc-dir-mode'
694buffers will delete the marked files (or if no files are marked, the
695file under point). This command does not notify the VC backend, and
696is mostly useful for unregistered files.
697
693** Diff mode 698** Diff mode
694+++ 699+++
695*** Hunks are now automatically refined by font-lock. 700*** Hunks are now automatically refined by font-lock.
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index be1084d4abe..79f395c4822 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -180,6 +180,9 @@ See `run-hooks'."
180 (define-key map [open] 180 (define-key map [open]
181 '(menu-item "Open File" vc-dir-find-file 181 '(menu-item "Open File" vc-dir-find-file
182 :help "Find the file on the current line")) 182 :help "Find the file on the current line"))
183 (define-key map [delete]
184 '(menu-item "Delete" vc-dir-delete-files-no-vc
185 :help "Delete the marked files"))
183 (define-key map [sepvcdet] '("--")) 186 (define-key map [sepvcdet] '("--"))
184 ;; FIXME: This needs a key binding. And maybe a better name 187 ;; FIXME: This needs a key binding. And maybe a better name
185 ;; ("Insert" like PCL-CVS uses does not sound that great either)... 188 ;; ("Insert" like PCL-CVS uses does not sound that great either)...
@@ -264,6 +267,7 @@ See `run-hooks'."
264 ;; bound by `special-mode'. 267 ;; bound by `special-mode'.
265 ;; Marking. 268 ;; Marking.
266 (define-key map "m" 'vc-dir-mark) 269 (define-key map "m" 'vc-dir-mark)
270 (define-key map "d" 'vc-dir-delete-files-no-vc)
267 (define-key map "M" 'vc-dir-mark-all-files) 271 (define-key map "M" 'vc-dir-mark-all-files)
268 (define-key map "u" 'vc-dir-unmark) 272 (define-key map "u" 'vc-dir-unmark)
269 (define-key map "U" 'vc-dir-unmark-all-files) 273 (define-key map "U" 'vc-dir-unmark-all-files)
@@ -762,8 +766,21 @@ that share the same state."
762 (interactive "e") 766 (interactive "e")
763 (vc-dir-at-event e (vc-dir-mark-unmark 'vc-dir-toggle-mark-file))) 767 (vc-dir-at-event e (vc-dir-mark-unmark 'vc-dir-toggle-mark-file)))
764 768
769(defun vc-dir-delete-files-no-vc ()
770 "Delete the marked files, or the current file if no marks.
771The files will not be marked as deleted in the version control
772system; see `vc-dir-delete-file'."
773 (interactive)
774 (map-y-or-n-p "Delete %s? "
775 #'delete-file
776 (or (vc-dir-marked-files)
777 (list (vc-dir-current-file))))
778 (revert-buffer))
779
765(defun vc-dir-delete-file () 780(defun vc-dir-delete-file ()
766 "Delete the marked files, or the current file if no marks." 781 "Delete the marked files, or the current file if no marks.
782The files will also be marked as deleted in the version control
783system."
767 (interactive) 784 (interactive)
768 (mapc 'vc-delete-file (or (vc-dir-marked-files) 785 (mapc 'vc-delete-file (or (vc-dir-marked-files)
769 (list (vc-dir-current-file))))) 786 (list (vc-dir-current-file)))))