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 version control operation on marked files/directories.

When only files are marked then call vc-next-action with the same value of the VERBOSE argument. When also directories are marked then call vc-dir and mark the same files/directories in the VC-Dir buffer that were marked in the Dired buffer.

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 version control operation on marked files/directories.
When only files are marked then call `vc-next-action' with the
same value of the VERBOSE argument.
When also directories are marked then call `vc-dir' and mark
the same files/directories in the VC-Dir buffer that were marked
in the Dired buffer."
  (interactive "P")
  (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))))
    (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))))