emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

support VC operations from dired


From: Dan Nicolaescu
Subject: support VC operations from dired
Date: Sun, 20 Sep 2009 14:22:12 -0700 (PDT)

Here's a minimal patch (minimally tested too) to support diff and log
from dired buffers.

State changing operations seems to be more complicated to support, so an
error is thrown (and this makes use of the vc-deduce-fileset's
previously unused argument OBSERVER).

I don't have much interest in working on this further, but if people
find it useful, please check it in.

Index: vc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v
retrieving revision 1.729
diff -u -3 -p -u -p -r1.729 vc.el
--- vc.el       14 Sep 2009 04:38:56 -0000      1.729
+++ vc.el       20 Sep 2009 20:20:56 -0000
@@ -913,6 +913,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)
@@ -943,6 +947,11 @@ current buffer."
              (list buffer-file-name))))
      (t (error "No fileset is available here.")))))
 
+
+(defun vc-dired-deduce-fileset ()
+  (list (vc-responsible-backend default-directory)
+       (dired-map-over-marks (dired-get-filename) nil)))
+
 (defun vc-ensure-vc-buffer ()
   "Make sure that the current buffer visits a version-controlled file."
   (cond
@@ -1598,7 +1607,7 @@ saving the buffer."
   (if historic
       (call-interactively 'vc-version-diff)
     (when buffer-file-name (vc-buffer-sync not-urgent))
-    (vc-diff-internal t (vc-deduce-fileset) nil nil (interactive-p))))
+    (vc-diff-internal t (vc-deduce-fileset t) nil nil (interactive-p))))
 
 ;;;###autoload
 (defun vc-root-diff (historic &optional not-urgent)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]