aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2020-04-03 01:08:09 +0300
committerJuri Linkov2020-04-03 01:08:09 +0300
commitadfcc17e6ff9e66e9f9bf8d9f5d3236aef4ba4e0 (patch)
tree9cbd33e4ffcbdcc6bfb0503771fcd5797a2d60d9
parentbb729496f9b699896fed8d65bf499a193a7c4886 (diff)
downloademacs-adfcc17e6ff9e66e9f9bf8d9f5d3236aef4ba4e0.tar.gz
emacs-adfcc17e6ff9e66e9f9bf8d9f5d3236aef4ba4e0.zip
* lisp/vc/vc-dir.el: Commands to mark un/registered files (bug#34949)
* lisp/vc/vc-dir.el (vc-dir-mark-state-files): New function. (vc-dir-mark-registered-files) (vc-dir-mark-unregistered-files): New commands. (vc-dir-mode-map): Bind vc-dir-mark-registered-files to '* r'. (vc-dir-menu-map): Add menu entries for vc-dir-mark-registered-files and vc-dir-mark-unregistered-files.
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/vc/vc-dir.el31
2 files changed, 34 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 765a923bf77..4acf0f4820e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -115,6 +115,9 @@ directories with the help of new command 'dired-vc-next-action'.
115 115
116*** New command 'vc-dir-root' uses the root directory without asking. 116*** New command 'vc-dir-root' uses the root directory without asking.
117 117
118*** New commands 'vc-dir-mark-registered-files' (bound to '* r') and
119'vc-dir-mark-unregistered-files'.
120
118** Gnus 121** Gnus
119 122
120--- 123---
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index ab5943917b8..0c9e656add4 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -147,6 +147,12 @@ See `run-hooks'."
147 '(menu-item "Unmark Previous " vc-dir-unmark-file-up 147 '(menu-item "Unmark Previous " vc-dir-unmark-file-up
148 :help "Move to the previous line and unmark the file")) 148 :help "Move to the previous line and unmark the file"))
149 149
150 (define-key map [mark-unregistered]
151 '(menu-item "Mark Unregistered" vc-dir-mark-unregistered-files
152 :help "Mark all files in the unregistered state"))
153 (define-key map [mark-registered]
154 '(menu-item "Mark Registered" vc-dir-mark-registered-files
155 :help "Mark all files in the state edited, added or removed"))
150 (define-key map [mark-all] 156 (define-key map [mark-all]
151 '(menu-item "Mark All" vc-dir-mark-all-files 157 '(menu-item "Mark All" vc-dir-mark-all-files
152 :help "Mark all files that are in the same state as the current file\ 158 :help "Mark all files that are in the same state as the current file\
@@ -310,6 +316,10 @@ See `run-hooks'."
310 (define-key branch-map "l" 'vc-print-branch-log) 316 (define-key branch-map "l" 'vc-print-branch-log)
311 (define-key branch-map "s" 'vc-retrieve-tag)) 317 (define-key branch-map "s" 'vc-retrieve-tag))
312 318
319 (let ((mark-map (make-sparse-keymap)))
320 (define-key map "*" mark-map)
321 (define-key mark-map "r" 'vc-dir-mark-registered-files))
322
313 ;; Hook up the menu. 323 ;; Hook up the menu.
314 (define-key map [menu-bar vc-dir-mode] 324 (define-key map [menu-bar vc-dir-mode]
315 `(menu-item 325 `(menu-item
@@ -707,6 +717,27 @@ MARK-FILES should be a list of absolute filenames."
707 t)) 717 t))
708 vc-ewoc)) 718 vc-ewoc))
709 719
720(defun vc-dir-mark-state-files (states)
721 "Mark files that are in the state specified by the list in STATES."
722 (unless (listp states)
723 (setq states (list states)))
724 (ewoc-map
725 (lambda (filearg)
726 (when (memq (vc-dir-fileinfo->state filearg) states)
727 (setf (vc-dir-fileinfo->marked filearg) t)
728 t))
729 vc-ewoc))
730
731(defun vc-dir-mark-registered-files ()
732 "Mark files that are in one of registered state: edited, added or removed."
733 (interactive)
734 (vc-dir-mark-state-files '(edited added removed)))
735
736(defun vc-dir-mark-unregistered-files ()
737 "Mark files that are in unregistered state."
738 (interactive)
739 (vc-dir-mark-state-files 'unregistered))
740
710(defun vc-dir-unmark-file () 741(defun vc-dir-unmark-file ()
711 ;; Unmark the current file and move to the next line. 742 ;; Unmark the current file and move to the next line.
712 (let* ((crt (ewoc-locate vc-ewoc)) 743 (let* ((crt (ewoc-locate vc-ewoc))