From bd6dcb778f27fae87d4150b3ad9889153a49e676 Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Sat, 12 Jul 2025 11:34:31 +0100 Subject: [PATCH] dired-vc-deduce-fileset: Call vc-backend-for-registration * lisp/vc/vc.el (vc-backend-for-registration): * lisp/dired-aux.el (vc-backend-for-registration): Autoload. (dired-vc-deduce-fileset): Call vc-backend-for-registration when vc-responsible-backend returns nil (bug#78987). (cherry picked from commit b406c44c824ba87d516c01466bdd1688cc55fc6f) --- lisp/dired-aux.el | 6 ++++-- lisp/vc/vc.el | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index a7cec53349c..7db34777b72 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1087,6 +1087,7 @@ Return the result of `process-file' - zero for success." (autoload 'Man-support-local-filenames "man") (autoload 'vc-responsible-backend "vc") +(autoload 'vc-backend-for-registration "vc") (defvar dired-guess-shell-alist-default (list @@ -3973,8 +3974,9 @@ In this case, the VERBOSE argument is ignored." ;;;###autoload (defun dired-vc-deduce-fileset (&optional state-model-only-files not-state-changing) - (let ((backend (vc-responsible-backend default-directory)) - (files (dired-get-marked-files nil nil nil nil t))) + (let* ((files (dired-get-marked-files nil nil nil nil t)) + (backend (or (vc-responsible-backend default-directory) + (vc-backend-for-registration (car files))))) (when (and (not not-state-changing) (cl-some #'file-directory-p files)) (user-error "\ diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 45095a331ed..56245f77607 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1101,6 +1101,7 @@ Return the result of evaluating FORM." ;;; Code for deducing what fileset and backend to assume +;;;###autoload (defun vc-backend-for-registration (file) "Return a backend that can be used for registering FILE. -- 2.39.5