bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34949: 27.0.50; Docstring of `vc-deduce-fileset' incomplete


From: Juri Linkov
Subject: bug#34949: 27.0.50; Docstring of `vc-deduce-fileset' incomplete
Date: Tue, 31 Mar 2020 01:40:04 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> Actually, marking all files with 'C-u M' is not useless.  There are
>> other VC commands that make sense to run on all marked files, e.g.
>> search in all files marked by 'C-u M', query-replace, delete, etc.
>
> Hmm, you might be right. If we're sure that people do take advantage of
> that, let's keep it.
>
> We could tweak it a little, though. Like:
>
>           M -> mark all files in the same status
>       C-u M -> mark all registered files
>   C-u C-u M -> mark all files in the vc-dir buffer

Too messy to overload the binding with long prefixes with different meanings.

> Or bind vc-dir-mark-registered to a new char indeed, e.g. 'r'.

Better to bind to the mnemonic key '* r' as in this patch.

I still don't understand why Drew insists on 100% compatibility
between Dired and VC-Dir - they already diverged:
'M' in Dired doesn't mark files like it does in VC-Dir.

diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index ab5943917b..0c9e656add 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -147,6 +147,12 @@ vc-dir-menu-map
       '(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 @@ vc-dir-mode-map
       (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 @@ vc-dir-mark-files
        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))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]