unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@ics.uci.edu>
To: Miles Bader <miles@gnu.org>
Cc: emacs-devel@gnu.org
Subject: support VC operations from dired
Date: Sun, 20 Sep 2009 14:22:12 -0700 (PDT)	[thread overview]
Message-ID: <200909202122.n8KLMCIb028441@godzilla.ics.uci.edu> (raw)


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	other threads:[~2009-09-20 21:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-20 21:22 Dan Nicolaescu [this message]
2009-09-21 21:51 ` support VC operations from dired Juri Linkov
2009-09-21 22:45   ` Dan Nicolaescu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200909202122.n8KLMCIb028441@godzilla.ics.uci.edu \
    --to=dann@ics.uci.edu \
    --cc=emacs-devel@gnu.org \
    --cc=miles@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).