Subject: bug#4677 closed by Dan Nicolaescu <[email-masked]> (Re: bug#4677: allow VC operations from dired)

From: [email-masked] (Emacs bug Tracking System)
Date: Fri, 20 Nov 2009 16:45:08 +0000

This is an automatic notification regarding your bug report
which was filed against the emacs package:

#4677: allow VC operations from dired

It has been closed by Dan Nicolaescu <[email-masked]>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Dan Nicolaescu <[email-masked]> by
replying to this email.

-- 
4677: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4677
Emacs Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#4677: allow VC operations from dired
From: Dan Nicolaescu <[email-masked]>
To: Stefan Monnier <[email-masked]>
Cc: [email-masked]
Date: Fri, 20 Nov 2009 08:37:09 -0800 (PST)

Stefan Monnier <[email-masked]> writes:

  > > Stefan, any reason not to install this patch (the up to date version of it)?
  > 
  > Not that I know,

Done. Thanks.

Subject: allow VC operations from dired
From: Dan Nicolaescu <[email-masked]>
To: bug-gnu-emacs <[email-masked]>
Date: Thu, 8 Oct 2009 13:19:59 -0700 (PDT)

This patch allows VC operations to be run from dired.
State changing VC operations are not supported. 
(only the various variations of log and diff)

OK to check in?

Index: vc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v
retrieving revision 1.732
diff -u -3 -p -r1.732 vc.el
--- vc.el	3 Oct 2009 18:29:26 -0000	1.732
+++ vc.el	8 Oct 2009 20:17:08 -0000
@@ -634,7 +634,8 @@
 (require 'vc-dispatcher)
 
 (eval-when-compile
-  (require 'cl))
+  (require 'cl)
+  (require 'dired))
 
 (unless (assoc 'vc-parent-buffer minor-mode-alist)
   (setq minor-mode-alist
@@ -889,6 +903,10 @@ current buffer."
     (cond
      ((derived-mode-p 'vc-dir-mode)
       (vc-dir-deduce-fileset state-model-only-files))
+     ((derived-mode-p 'dired-mode)
+      (if observer
+	  (vc-dired-deduce-fileset)
+	(error "State changing VC operations not supported in `dired-mode'")))
      ((setq backend (vc-backend buffer-file-name))
       (if state-model-only-files
 	(list backend (list buffer-file-name)
@@ -921,4 +939,9 @@
 
+
+(defun vc-dired-deduce-fileset ()
+  (list (vc-responsible-backend default-directory)
+	(dired-map-over-marks (dired-get-filename nil t) nil)))
+
 (defun vc-ensure-vc-buffer ()
   "Make sure that the current buffer visits a version-controlled file."
   (cond
@@ -1590,6 +1613,7 @@ 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))))
 	  rootdir working-revision)
       (unless backend
@@ -1881,6 +1905,7 @@ If WORKING-REVISION is non-nil, leave th
   (interactive)
   (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))))
 	rootdir working-revision)
     (unless backend