changeset 94974:3a282ce8370c

Make vc-deduce-fileset do the right thing in derived buffers.
author Eric S. Raymond <esr@snark.thyrsus.com>
date Wed, 14 May 2008 17:12:38 +0000
parents c7204aaea55b
children 5bb8f7b3f835
files lisp/ChangeLog lisp/vc.el
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed May 14 15:24:21 2008 +0000
+++ b/lisp/ChangeLog	Wed May 14 17:12:38 2008 +0000
@@ -1,3 +1,8 @@
+2008-05-14  Eric S. Raymond  <esr@snark.thyrsus.com>
+
+	* vc.el (vc-deduce-fileset): Do the right thing when visting a
+	buffer (say, a log buffer or diff buffer) with a vc-dir buffer as parent.
+
 2008-05-14  John Paul Wallington  <jpw@pobox.com>
 
 	* international/mule.el (convert-define-charset-argument): Remove
--- a/lisp/vc.el	Wed May 14 15:24:21 2008 +0000
+++ b/lisp/vc.el	Wed May 14 17:12:38 2008 +0000
@@ -982,12 +982,19 @@
       (push node flattened))
     (nreverse flattened)))
 
+(defun vc-derived-from-dir-mode (&optional buffer)
+  "Are we in a VC-directory buffer, or do we have one as an ancestor?"
+  (let ((buffer (or buffer (current-buffer))))
+    (cond ((derived-mode-p 'vc-dir-mode) t)
+	  (vc-parent-buffer (vc-derived-from-dir-mode vc-parent-buffer))
+	  (t nil))))
+
 (defun vc-deduce-fileset (&optional observer)
   "Deduce a set of files and a backend to which to apply an operation and
 the common state of the fileset.  Return (BACKEND . FILESET)."
   (let* ((fileset (vc-dispatcher-selection-set observer))
          ;; FIXME: Store the backend in a buffer-local variable.
-         (backend (if (derived-mode-p 'vc-dir-mode)
+         (backend (if (vc-derived-from-dir-mode (current-buffer))
                       (vc-responsible-backend default-directory)
                     (assert (and (= 1 (length fileset))
                                  (not (file-directory-p (car fileset)))))