diff options
| author | Lars Ingebrigtsen | 2019-07-14 14:25:44 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-07-14 14:25:44 +0200 |
| commit | d3256dc78a464117c4fef98b572611370482763a (patch) | |
| tree | c186ba38662d1289353963c8a97e513668e68bf0 | |
| parent | ba51c80c304c4241d7971c6d4734c57b8864d776 (diff) | |
| download | emacs-d3256dc78a464117c4fef98b572611370482763a.tar.gz emacs-d3256dc78a464117c4fef98b572611370482763a.zip | |
Rename vc-dir-delete-files-no-vc to vc-dir-clean-files
* doc/emacs/maintaining.texi (VC Directory Commands): Adjust
command name.
* lisp/vc/vc-dir.el (vc-dir-clean-files): Rename from
vc-dir-delete-files-no-vc, and work on unregistered files only
(bug#31732).
(vc-dir-menu-map): Adjust command name.
| -rw-r--r-- | doc/emacs/maintaining.texi | 2 | ||||
| -rw-r--r-- | etc/NEWS | 2 | ||||
| -rw-r--r-- | lisp/vc/vc-dir.el | 25 |
3 files changed, 19 insertions, 10 deletions
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 42ea4d3254d..c3895bffb5e 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi | |||
| @@ -1354,7 +1354,7 @@ Branches}. | |||
| 1354 | 1354 | ||
| 1355 | @item d | 1355 | @item d |
| 1356 | Delete the marked files, or the current file if no marks | 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 | 1357 | (@code{vc-dir-clean-delete)}. The files will not be marked as |
| 1358 | deleted in the version control system, so this function is mostly | 1358 | deleted in the version control system, so this function is mostly |
| 1359 | useful for unregistered files. | 1359 | useful for unregistered files. |
| 1360 | @end table | 1360 | @end table |
| @@ -694,7 +694,7 @@ print diffs and logs between the merge base (common ancestor) of two | |||
| 694 | given revisions. | 694 | given revisions. |
| 695 | 695 | ||
| 696 | +++ | 696 | +++ |
| 697 | *** The new `d' command (`vc-dir-delete-files-no-vc') in `vc-dir-mode' | 697 | *** The new `d' command (`vc-dir-clean-files') in `vc-dir-mode' |
| 698 | buffers will delete the marked files (or if no files are marked, the | 698 | buffers will delete the marked files (or if no files are marked, the |
| 699 | file under point). This command does not notify the VC backend, and | 699 | file under point). This command does not notify the VC backend, and |
| 700 | is mostly useful for unregistered files. | 700 | is mostly useful for unregistered files. |
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 79f395c4822..436a0a67223 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | (require 'vc) | 41 | (require 'vc) |
| 42 | (require 'tool-bar) | 42 | (require 'tool-bar) |
| 43 | (require 'ewoc) | 43 | (require 'ewoc) |
| 44 | (require 'seq) | ||
| 44 | 45 | ||
| 45 | ;;; Code: | 46 | ;;; Code: |
| 46 | (eval-when-compile (require 'cl-lib)) | 47 | (eval-when-compile (require 'cl-lib)) |
| @@ -181,8 +182,8 @@ See `run-hooks'." | |||
| 181 | '(menu-item "Open File" vc-dir-find-file | 182 | '(menu-item "Open File" vc-dir-find-file |
| 182 | :help "Find the file on the current line")) | 183 | :help "Find the file on the current line")) |
| 183 | (define-key map [delete] | 184 | (define-key map [delete] |
| 184 | '(menu-item "Delete" vc-dir-delete-files-no-vc | 185 | '(menu-item "Delete" vc-dir-clean-files |
| 185 | :help "Delete the marked files")) | 186 | :help "Delete the unregistered marked files")) |
| 186 | (define-key map [sepvcdet] '("--")) | 187 | (define-key map [sepvcdet] '("--")) |
| 187 | ;; FIXME: This needs a key binding. And maybe a better name | 188 | ;; FIXME: This needs a key binding. And maybe a better name |
| 188 | ;; ("Insert" like PCL-CVS uses does not sound that great either)... | 189 | ;; ("Insert" like PCL-CVS uses does not sound that great either)... |
| @@ -267,7 +268,7 @@ See `run-hooks'." | |||
| 267 | ;; bound by `special-mode'. | 268 | ;; bound by `special-mode'. |
| 268 | ;; Marking. | 269 | ;; Marking. |
| 269 | (define-key map "m" 'vc-dir-mark) | 270 | (define-key map "m" 'vc-dir-mark) |
| 270 | (define-key map "d" 'vc-dir-delete-files-no-vc) | 271 | (define-key map "d" 'vc-dir-clean-files) |
| 271 | (define-key map "M" 'vc-dir-mark-all-files) | 272 | (define-key map "M" 'vc-dir-mark-all-files) |
| 272 | (define-key map "u" 'vc-dir-unmark) | 273 | (define-key map "u" 'vc-dir-unmark) |
| 273 | (define-key map "U" 'vc-dir-unmark-all-files) | 274 | (define-key map "U" 'vc-dir-unmark-all-files) |
| @@ -766,16 +767,24 @@ that share the same state." | |||
| 766 | (interactive "e") | 767 | (interactive "e") |
| 767 | (vc-dir-at-event e (vc-dir-mark-unmark 'vc-dir-toggle-mark-file))) | 768 | (vc-dir-at-event e (vc-dir-mark-unmark 'vc-dir-toggle-mark-file))) |
| 768 | 769 | ||
| 769 | (defun vc-dir-delete-files-no-vc () | 770 | (defun vc-dir-clean-files () |
| 770 | "Delete the marked files, or the current file if no marks. | 771 | "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 | The files will not be marked as deleted in the version control |
| 772 | system; see `vc-dir-delete-file'." | 773 | system; see `vc-dir-delete-file'." |
| 773 | (interactive) | 774 | (interactive) |
| 774 | (map-y-or-n-p "Delete %s? " | 775 | (let* ((files (or (vc-dir-marked-files) |
| 775 | #'delete-file | ||
| 776 | (or (vc-dir-marked-files) | ||
| 777 | (list (vc-dir-current-file)))) | 776 | (list (vc-dir-current-file)))) |
| 778 | (revert-buffer)) | 777 | (tracked |
| 778 | (seq-filter (lambda (file) | ||
| 779 | (not (eq (vc-call-backend vc-dir-backend 'state file) | ||
| 780 | 'unregistered))) | ||
| 781 | files))) | ||
| 782 | (when tracked | ||
| 783 | (user-error "Trying to clean tracked file%s: %s" | ||
| 784 | (if (= (length tracked) 1) "" "s") | ||
| 785 | (mapconcat #'file-name-nondirectory tracked ", "))) | ||
| 786 | (map-y-or-n-p "Delete %s? " #'delete-file files) | ||
| 787 | (revert-buffer))) | ||
| 779 | 788 | ||
| 780 | (defun vc-dir-delete-file () | 789 | (defun vc-dir-delete-file () |
| 781 | "Delete the marked files, or the current file if no marks. | 790 | "Delete the marked files, or the current file if no marks. |