[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master adfcc17: * lisp/vc/vc-dir.el: Commands to mark un/registered file
From: |
Juri Linkov |
Subject: |
master adfcc17: * lisp/vc/vc-dir.el: Commands to mark un/registered files (bug#34949) |
Date: |
Thu, 2 Apr 2020 18:08:16 -0400 (EDT) |
branch: master
commit adfcc17e6ff9e66e9f9bf8d9f5d3236aef4ba4e0
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>
* 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.
---
etc/NEWS | 3 +++
lisp/vc/vc-dir.el | 31 +++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/etc/NEWS b/etc/NEWS
index 765a923..4acf0f4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -115,6 +115,9 @@ directories with the help of new command
'dired-vc-next-action'.
*** New command 'vc-dir-root' uses the root directory without asking.
+*** New commands 'vc-dir-mark-registered-files' (bound to '* r') and
+'vc-dir-mark-unregistered-files'.
+
** Gnus
---
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index ab59439..0c9e656 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -147,6 +147,12 @@ See `run-hooks'."
'(menu-item "Unmark Previous " vc-dir-unmark-file-up
:help "Move to the previous line and unmark the file"))
+ (define-key map [mark-unregistered]
+ '(menu-item "Mark Unregistered" vc-dir-mark-unregistered-files
+ :help "Mark all files in the unregistered state"))
+ (define-key map [mark-registered]
+ '(menu-item "Mark Registered" vc-dir-mark-registered-files
+ :help "Mark all files in the state edited, added or
removed"))
(define-key map [mark-all]
'(menu-item "Mark All" vc-dir-mark-all-files
:help "Mark all files that are in the same state as the
current file\
@@ -310,6 +316,10 @@ See `run-hooks'."
(define-key branch-map "l" 'vc-print-branch-log)
(define-key branch-map "s" 'vc-retrieve-tag))
+ (let ((mark-map (make-sparse-keymap)))
+ (define-key map "*" mark-map)
+ (define-key mark-map "r" 'vc-dir-mark-registered-files))
+
;; Hook up the menu.
(define-key map [menu-bar vc-dir-mode]
`(menu-item
@@ -707,6 +717,27 @@ MARK-FILES should be a list of absolute filenames."
t))
vc-ewoc))
+(defun vc-dir-mark-state-files (states)
+ "Mark files that are in the state specified by the list in STATES."
+ (unless (listp states)
+ (setq states (list states)))
+ (ewoc-map
+ (lambda (filearg)
+ (when (memq (vc-dir-fileinfo->state filearg) states)
+ (setf (vc-dir-fileinfo->marked filearg) t)
+ t))
+ vc-ewoc))
+
+(defun vc-dir-mark-registered-files ()
+ "Mark files that are in one of registered state: edited, added or removed."
+ (interactive)
+ (vc-dir-mark-state-files '(edited added removed)))
+
+(defun vc-dir-mark-unregistered-files ()
+ "Mark files that are in unregistered state."
+ (interactive)
+ (vc-dir-mark-state-files 'unregistered))
+
(defun vc-dir-unmark-file ()
;; Unmark the current file and move to the next line.
(let* ((crt (ewoc-locate vc-ewoc))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master adfcc17: * lisp/vc/vc-dir.el: Commands to mark un/registered files (bug#34949),
Juri Linkov <=