[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7350: 24.0.50; make vc-deduce-backend smarter

From: Bob Rogers
Subject: bug#7350: 24.0.50; make vc-deduce-backend smarter
Date: Sat, 6 Nov 2010 18:18:08 -0400

   I notice that vc-root-diff only works if the current buffer is
visiting a version-controlled file, and in certain other buffer modes.
In particular, it works in dired-mode, where it uses the
default-directory, but not in shell-mode, which is not one of the
explicit special cases.  ISTM that using default-directory would make a
better default case, since that ought to DTRT in the majority of cases.
Indeed, one might be able to get rid of some of the other
vc-deduce-backend cases, since most such modes seem to need to set up
the right default-directory anyway.

                                        -- Bob Rogers

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 665dafb..ddeb546 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -920,9 +920,9 @@ Within directories, only files already under version 
control are noticed."
   (cond ((derived-mode-p 'vc-dir-mode)   vc-dir-backend)
        ((derived-mode-p 'log-view-mode) log-view-vc-backend)
        ((derived-mode-p 'diff-mode)     diff-vc-backend)
-       ((derived-mode-p 'dired-mode)
-        (vc-responsible-backend default-directory))
-       (vc-mode (vc-backend buffer-file-name))))
+       (vc-mode (vc-backend buffer-file-name))
+       (default-directory
+        (vc-responsible-backend default-directory))))
 (declare-function vc-dir-current-file "vc-dir" ())
 (declare-function vc-dir-deduce-fileset "vc-dir" (&optional 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]