Function: dired-vc-next-action
dired-vc-next-action is an autoloaded, interactive and byte-compiled
function defined in dired-aux.el.gz.
Signature
(dired-vc-next-action VERBOSE)
Documentation
Do the next logical version control operation on marked files/directories.
The VC control operation will operate on a fileset which includes the marked files/directories. If no files/directories are marked, the fileset will include the single file/directory shown on the current line.
If only regular files are in the fileset, call vc-next-action with
the same value of the VERBOSE argument (interactively, the prefix
argument).
If one or more directories are in the fileset, start vc-dir in the root
directory of the repository that includes the current directory, with
the same files/directories marked in the VC-Directory buffer that were
marked in the original Dired buffer. If the current directory doesn't
belong to a VCS repository, prompt for a repository directory. In this
case, the VERBOSE argument is ignored.
Probably introduced at or before Emacs version 28.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/dired-aux.el.gz
;;;###autoload
(defun dired-vc-next-action (verbose)
"Do the next logical version control operation on marked files/directories.
The VC control operation will operate on a fileset which includes
the marked files/directories. If no files/directories are marked, the
fileset will include the single file/directory shown on the current line.
If only regular files are in the fileset, call `vc-next-action' with
the same value of the VERBOSE argument (interactively, the prefix
argument).
If one or more directories are in the fileset, start `vc-dir' in the root
directory of the repository that includes the current directory, with
the same files/directories marked in the VC-Directory buffer that were
marked in the original Dired buffer. If the current directory doesn't
belong to a VCS repository, prompt for a repository directory. In this
case, the VERBOSE argument is ignored."
(interactive "P" dired-mode)
(let* ((marked-files
(dired-get-marked-files nil nil nil nil t))
(mark-files
(when (cl-some #'file-directory-p marked-files)
;; Fix deficiency of Dired by adding slash to dirs
(mapcar (lambda (file)
(if (file-directory-p file)
(file-name-as-directory file)
file))
marked-files))))
(dired-post-do-command)
(if mark-files
(let ((transient-hook (make-symbol "vc-dir-mark-files")))
(fset transient-hook
(lambda ()
(remove-hook 'vc-dir-refresh-hook transient-hook t)
(vc-dir-unmark-all-files t)
(vc-dir-mark-files mark-files)))
(vc-dir-root)
(add-hook 'vc-dir-refresh-hook transient-hook nil t))
(vc-next-action verbose))))