summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2023-11-14 09:44:15 +0200
committerJuri Linkov <juri@linkov.net>2023-11-14 09:44:42 +0200
commit7d42a76234ea5ca417915f8d5d755cc1f5aae7e5 (patch)
tree111ffcc78a02cc0393e793074ccdcf62570c90e4 /lisp
parentbda31b2c6d62652c742e800b692dffd926f8284b (diff)
* lisp/vc/vc.el (vc-deduce-backend-nonvc-modes): New variable (bug#67145).
(vc-deduce-backend): Use it.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/vc/vc.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 95f9218dcbf..d768af678c3 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1071,14 +1071,20 @@ Within directories, only files already under version control are noticed."
(defvar diff-vc-backend)
(defvar diff-vc-revisions)
+;; Maybe we could even use comint-mode rather than shell-mode?
+(defvar vc-deduce-backend-nonvc-modes
+ '(dired-mode shell-mode eshell-mode compilation-mode)
+ "List of modes not supported by VC where backend should be deduced.
+In these modes the backend is deduced based on `default-directory'.
+When nil, the backend is deduced in all modes.")
+
(defun vc-deduce-backend ()
(cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend)
((derived-mode-p 'log-view-mode) log-view-vc-backend)
((derived-mode-p 'log-edit-mode) log-edit-vc-backend)
((derived-mode-p 'diff-mode) diff-vc-backend)
- ;; Maybe we could even use comint-mode rather than shell-mode?
- ((derived-mode-p
- 'dired-mode 'shell-mode 'eshell-mode 'compilation-mode)
+ ((or (null vc-deduce-backend-nonvc-modes)
+ (apply #'derived-mode-p vc-deduce-backend-nonvc-modes))
(ignore-errors (vc-responsible-backend default-directory)))
(vc-mode (vc-backend buffer-file-name))))