unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* support VC operations from dired
@ 2009-09-20 21:22 Dan Nicolaescu
  2009-09-21 21:51 ` Juri Linkov
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Nicolaescu @ 2009-09-20 21:22 UTC (permalink / raw
  To: Miles Bader; +Cc: emacs-devel


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)




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-21 22:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-20 21:22 support VC operations from dired Dan Nicolaescu
2009-09-21 21:51 ` Juri Linkov
2009-09-21 22:45   ` Dan Nicolaescu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).