GNU bug report logs - #34949
27.0.50; Docstring of `vc-deduce-fileset' incomplete

Previous Next

Package: emacs;

Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>

Date: Fri, 22 Mar 2019 18:04:02 UTC

Severity: minor

Tags: confirmed, fixed

Found in version 27.0.50

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 34949 <at> debbugs.gnu.org
Subject: bug#34949: 27.0.50; Docstring of `vc-deduce-fileset' incomplete
Date: Tue, 31 Mar 2020 01:40:04 +0300
[Message part 1 (text/plain, inline)]
>> 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.

[vc-dir-mark-registered-files.patch (text/x-diff, inline)]
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))

This bug report was last modified 5 years and 38 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.