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

From: Lars Magne Ingebrigtsen <[email-masked]>
Date: Mon, 04 Jul 2011 17:18:36 +0200

[email-masked] writes:

>    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"))

This looks very reasonable to me, but I'm not all that familiar with
vc.el internals.  Does anybody else have any opinions on this?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/