diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 0d9a0de8221..8780bd8b781 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1582,8 +1582,8 @@ basis using directory local variables (@pxref{Directory Variables}). @subsubsection VC Directory Commands Emacs provides several commands for navigating the VC Directory -buffer, and for marking files as belonging to the current VC -fileset. +buffer, for marking files as belonging to the current VC fileset, and +for operating on the VC fileset. @table @kbd @item n @@ -1647,6 +1647,12 @@ prefix, do this with all the marked files. Discard all the changes you have made to the current fileset (@code{vc-revert}). +@item V +Take the next logical version control operation on all files shown in +the VC Directory buffer (@code{vc-dir-root-next-action}). This is like +@w{@kbd{C-x v v}} (@pxref{Basic VC Editing}) except that it ignores any +marks and the position of point. + @item q Quit the VC Directory buffer, and bury it (@code{quit-window}). diff --git a/etc/NEWS b/etc/NEWS index 2604092e268..6ea88aca195 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2794,6 +2794,12 @@ To restore the old, more limited behavior for VC Directory, you can do These correspond to the existing 'z p' to pop a stash and 'P' to pop the stash at point (deleting the stash at point is also bound to 'C-k'). ++++ +*** New VC Directory command 'V' ('vc-dir-root-next-action'). +This is like 'v' ('vc-next-action') but applies to the whole VC-Dir +buffer, ignoring the position of point and any marks. This is useful to +check in all local changes at once. + --- *** VC Directory can now register files when checking in mixed filesets. Previously, if some files to be checked in were unregistered but others diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 35eaf9a97b5..87f4a55850c 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -359,7 +359,6 @@ That is, refreshing the VC-Dir buffer also hides `up-to-date' and (define-key map "I" #'vc-root-log-incoming) ;; C-x v I (define-key map "O" #'vc-root-log-outgoing) ;; C-x v O ;; More confusing than helpful, probably - ;;(define-key map "R" #'vc-revert) ;; u is taken by vc-dir-unmark. ;;(define-key map "A" #'vc-annotate) ;; g is taken by revert-buffer ;; bound by `special-mode'. ;; Marking. @@ -403,6 +402,7 @@ That is, refreshing the VC-Dir buffer also hides `up-to-date' and (define-key map "TL" #'vc-root-log-outstanding) (define-key map "T=" #'vc-diff-outstanding) (define-key map "TD" #'vc-root-diff-outstanding) + (define-key map "V" #'vc-dir-root-next-action) (let ((branch-map (make-sparse-keymap))) (define-key map "b" branch-map) @@ -1011,6 +1011,27 @@ that share the same state." (interactive "e") (vc-dir-at-event e (vc-dir-mark-unmark 'vc-dir-toggle-mark-file))) +(defun vc-dir-root-next-action () + "Like `vc-next-action' but for all files shown in the VC-Dir buffer. +This command ignores VC-Dir marks and the position of point. +When the VC-Dir's root directory is the repository root (as it usually +is), this command is useful to check in all local changes at once." + (interactive) + (let* ((only-files-list + (cl-loop for crt = (ewoc-nth vc-ewoc 0) + then (ewoc-next vc-ewoc crt) + while crt + for data = (ewoc-data crt) + unless (vc-dir-fileinfo->directory data) collect + (cons (expand-file-name (vc-dir-fileinfo->name data)) + (vc-dir-fileinfo->state data)))) + (vc-buffer-overriding-fileset + `(,vc-dir-backend + (,default-directory) + . ,(vc-only-files-state-and-model only-files-list + vc-dir-backend)))) + (vc-next-action nil))) + (defun vc-dir-clean-files () "Delete marked files from repository, or the current file if no marks. This command cleans unregistered files from the repository.