(@code{vc-dir-mark-all-files}). With a prefix argument, mark all
listed files and directories.
+@findex vc-dir-mark-by-regexp
+@item %
+You can use this command to mark files by regexp
+(@code{vc-dir-mark-by-regexp}). If given a prefix, unmark files
+instead.
+
@item G
Add the file under point to the list of files that the VC should
ignore (@code{vc-dir-ignore}). For instance, if the VC is Git, it
** vc
++++
+*** New command '%' ('vc-dir-mark-by-regexp').
+This command marks files based on a regexp. If given a prefix
+argument, unmark instead.
+
---
*** 'C-x v v' on an unregistered file will now use the most specific backend.
Previously, if you had an SVN-covered "~/" directory, and a Git-covered
(define-key map "U" #'vc-dir-unmark-all-files)
(define-key map "\C-?" #'vc-dir-unmark-file-up)
(define-key map "\M-\C-?" #'vc-dir-unmark-all-files)
+ (define-key map "%" #'vc-dir-mark-by-regexp)
;; Movement.
(define-key map "n" #'vc-dir-next-line)
(define-key map " " #'vc-dir-next-line)
(vc-dir-mark-file crt)))
(setq crt (ewoc-next vc-ewoc crt))))))))
+(defun vc-dir-mark-by-regexp (regexp &optional unmark)
+ "Mark all files that match REGEXP.
+If UNMARK (interactively, the prefix), unmark instead."
+ (interactive "sMark files matching: \nP")
+ (ewoc-map
+ (lambda (filearg)
+ (when (and (not (vc-dir-fileinfo->directory filearg))
+ (eq (not unmark)
+ (not (vc-dir-fileinfo->marked filearg)))
+ ;; We don't want to match on the part of the file
+ ;; that's above the current directory.
+ (string-match-p regexp (file-relative-name
+ (vc-dir-fileinfo->name filearg))))
+ (setf (vc-dir-fileinfo->marked filearg) (not unmark))
+ t))
+ vc-ewoc))
+
(defun vc-dir-mark-files (mark-files)
"Mark files specified by file names in the argument MARK-FILES.
MARK-FILES should be a list of absolute filenames."