diff options
| author | Lars Ingebrigtsen | 2019-07-13 06:10:29 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-07-13 06:10:29 +0200 |
| commit | a3509a71c0a11ce3cfa6eb96c6452bff68fc5bd9 (patch) | |
| tree | 15d5542f702d83b3438d236489f5f6698e4e3d4d | |
| parent | e04f7c62fc363bf0434b748b4eff2f21f2a65838 (diff) | |
| download | emacs-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.texi | 9 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | 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 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 | |||
| 1349 | branch (@code{vc-print-branch-log}). | 1349 | branch (@code{vc-print-branch-log}). |
| 1350 | 1350 | ||
| 1351 | @item B s | 1351 | @item B s |
| 1352 | Switch to a branch (@code{vc-retrieve-tag}). @xref{Switching Branches}. | 1352 | Switch to a branch (@code{vc-retrieve-tag}). @xref{Switching |
| 1353 | Branches}. | ||
| 1354 | |||
| 1355 | @item d | ||
| 1356 | Delete 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 | ||
| 1358 | deleted in the version control system, so this function is mostly | ||
| 1359 | useful for unregistered files. | ||
| 1353 | @end table | 1360 | @end table |
| 1354 | 1361 | ||
| 1355 | @cindex stashes in version control | 1362 | @cindex stashes in version control |
| @@ -690,6 +690,11 @@ to Hg revert. | |||
| 690 | print diffs and logs between the merge base (common ancestor) of two | 690 | print diffs and logs between the merge base (common ancestor) of two |
| 691 | given revisions. | 691 | given revisions. |
| 692 | 692 | ||
| 693 | *** The new `d' command (`vc-dir-delete-files-no-vc') in `vc-dir-mode' | ||
| 694 | buffers will delete the marked files (or if no files are marked, the | ||
| 695 | file under point). This command does not notify the VC backend, and | ||
| 696 | is 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. | ||
| 771 | The files will not be marked as deleted in the version control | ||
| 772 | system; 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. |
| 782 | The files will also be marked as deleted in the version control | ||
| 783 | system." | ||
| 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))))) |