Subject: bug#6870: Make vc-root-diff work in more modes

From: [email-masked]
Date: Mon, 16 Aug 2010 21:55:39 -0400

It makes sense to me that vc-root-diff uses "(vc-responsible-backend
default-directory)" when in a dired-mode buffer.  But since vc-root-diff
is not at all about the current buffer, why not also make that the
default for shell-mode, diff-mode, or any of the other modes for
non-version-controlled buffers that may be generated in a working copy?

					-- Bob Rogers
					   http://www.rgrjr.com/

------------------------------------------------------------------------
diff --git a/lisp/vc.el b/lisp/vc.el
index 1e52a3c..abba202 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -1655,8 +1655,8 @@ saving the buffer."
     (when buffer-file-name (vc-buffer-sync not-urgent))
     (let ((backend
 	   (cond ((derived-mode-p 'vc-dir-mode)  vc-dir-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))
+		 (t (vc-responsible-backend default-directory))))
 	  rootdir working-revision)
       (unless backend
 	(error "Buffer is not version controlled"))