Subject: 24.0.50; make vc-deduce-backend smarter

From: Bob Rogers <[email-masked]>
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
					   http://www.rgrjr.com/

------------------------------------------------------------------------
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 state-model-only-files))