From 192350af69a3e439251af2520cd0626689edeadc Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 14 May 2008 17:12:38 +0000 Subject: [PATCH] Make vc-deduce-fileset do the right thing in derived buffers. --- lisp/ChangeLog | 5 +++++ lisp/vc.el | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 524dd2923f8..21fc108c895 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2008-05-14 Eric S. Raymond + + * 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 * international/mule.el (convert-define-charset-argument): Remove diff --git a/lisp/vc.el b/lisp/vc.el index 2795912dca1..d2791587fc3 100644 --- a/lisp/vc.el +++ b/lisp/vc.el @@ -982,12 +982,19 @@ Within directories, only files already under version control are noticed." (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))))) -- 2.39.5