all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@ics.uci.edu>
To: bug-gnu-emacs <bug-gnu-emacs@gnu.org>
Subject: bug#4677: allow VC operations from dired
Date: Thu, 8 Oct 2009 13:19:59 -0700 (PDT)	[thread overview]
Message-ID: <200910082019.n98KJxFW020300@godzilla.ics.uci.edu> (raw)


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






             reply	other threads:[~2009-10-08 20:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200911201637.nAKGb9go024620@godzilla.ics.uci.edu>
2009-10-08 20:19 ` Dan Nicolaescu [this message]
2009-10-11 23:55   ` bug#4677: allow VC operations from dired Juri Linkov
2009-10-12  2:46     ` Dan Nicolaescu
2009-10-12 20:27       ` Juri Linkov
2009-10-12 20:51         ` Dan Nicolaescu
2009-10-13 22:38           ` Juri Linkov
2009-10-13 23:22             ` Dan Nicolaescu
2009-10-23 18:21         ` Dan Nicolaescu
2009-11-19 16:50       ` Dan Nicolaescu
2009-11-19 21:08         ` Stefan Monnier
2009-11-20 16:45   ` bug#4677: marked as done (allow VC operations from dired) Emacs bug Tracking System

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

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

  git send-email \
    --in-reply-to=200910082019.n98KJxFW020300@godzilla.ics.uci.edu \
    --to=dann@ics.uci.edu \
    --cc=4677@emacsbugs.donarmstrong.com \
    --cc=bug-gnu-emacs@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.