[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master a3509a7 1/2: Add a new command in vc-dir mode to de
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master a3509a7 1/2: Add a new command in vc-dir mode to delete files |
Date: |
Sat, 13 Jul 2019 00:13:14 -0400 (EDT) |
branch: master
commit a3509a71c0a11ce3cfa6eb96c6452bff68fc5bd9
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
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).
---
doc/emacs/maintaining.texi | 9 ++++++++-
etc/NEWS | 5 +++++
lisp/vc/vc-dir.el | 19 ++++++++++++++++++-
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 4986c11..42ea4d3 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
branch (@code{vc-print-branch-log}).
@item B s
-Switch to a branch (@code{vc-retrieve-tag}). @xref{Switching Branches}.
+Switch to a branch (@code{vc-retrieve-tag}). @xref{Switching
+Branches}.
+
+@item d
+Delete the marked files, or the current file if no marks
+(@code{vc-dir-delete-files-no-vc)}. The files will not be marked as
+deleted in the version control system, so this function is mostly
+useful for unregistered files.
@end table
@cindex stashes in version control
diff --git a/etc/NEWS b/etc/NEWS
index 902203f..7ff2b42 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -690,6 +690,11 @@ to Hg revert.
print diffs and logs between the merge base (common ancestor) of two
given revisions.
+*** The new `d' command (`vc-dir-delete-files-no-vc') in `vc-dir-mode'
+buffers will delete the marked files (or if no files are marked, the
+file under point). This command does not notify the VC backend, and
+is mostly useful for unregistered files.
+
** Diff mode
+++
*** Hunks are now automatically refined by font-lock.
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index be1084d..79f395c 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -180,6 +180,9 @@ See `run-hooks'."
(define-key map [open]
'(menu-item "Open File" vc-dir-find-file
:help "Find the file on the current line"))
+ (define-key map [delete]
+ '(menu-item "Delete" vc-dir-delete-files-no-vc
+ :help "Delete the marked files"))
(define-key map [sepvcdet] '("--"))
;; FIXME: This needs a key binding. And maybe a better name
;; ("Insert" like PCL-CVS uses does not sound that great either)...
@@ -264,6 +267,7 @@ See `run-hooks'."
;; bound by `special-mode'.
;; Marking.
(define-key map "m" 'vc-dir-mark)
+ (define-key map "d" 'vc-dir-delete-files-no-vc)
(define-key map "M" 'vc-dir-mark-all-files)
(define-key map "u" 'vc-dir-unmark)
(define-key map "U" 'vc-dir-unmark-all-files)
@@ -762,8 +766,21 @@ that share the same state."
(interactive "e")
(vc-dir-at-event e (vc-dir-mark-unmark 'vc-dir-toggle-mark-file)))
+(defun vc-dir-delete-files-no-vc ()
+ "Delete the marked files, or the current file if no marks.
+The files will not be marked as deleted in the version control
+system; see `vc-dir-delete-file'."
+ (interactive)
+ (map-y-or-n-p "Delete %s? "
+ #'delete-file
+ (or (vc-dir-marked-files)
+ (list (vc-dir-current-file))))
+ (revert-buffer))
+
(defun vc-dir-delete-file ()
- "Delete the marked files, or the current file if no marks."
+ "Delete the marked files, or the current file if no marks.
+The files will also be marked as deleted in the version control
+system."
(interactive)
(mapc 'vc-delete-file (or (vc-dir-marked-files)
(list (vc-dir-current-file)))))