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

* Re: support VC operations from dired
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Juri Linkov @ 2009-09-21 21:51 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-devel, Miles Bader

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

Thanks, it works for directories and files in Dired.

I have one question: how is it supposed to log/diff the root dir
from Dired?  When I put point on the root dir in the dired buffer,
`C-x v l' fails with:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  expand-file-name(nil)
  vc-do-command("*vc-change-log*" 0 "rlog" ...)
  vc-rcs-print-log(... "*vc-change-log*" t)
  apply(vc-rcs-print-log (... "*vc-change-log*" t))
  vc-call-backend(RCS print-log (...) "*vc-change-log*" t)
  vc-print-log-internal(RCS (...) nil)
  vc-print-log()
  call-interactively(vc-print-log nil nil)

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: support VC operations from dired
  2009-09-21 21:51 ` Juri Linkov
@ 2009-09-21 22:45   ` Dan Nicolaescu
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Nicolaescu @ 2009-09-21 22:45 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel, Miles Bader

Juri Linkov <juri@jurta.org> writes:

  > > Here's a minimal patch (minimally tested too) to support diff and log
  > > from dired buffers.
  > 
  > Thanks, it works for directories and files in Dired.
  > 
  > I have one question: how is it supposed to log/diff the root dir
  > from Dired? 

It won't at the moment, at least the `cond' that computes the backend in
vc-root-diff and vc-root-print-log would need to be updated to deal with
dired buffers.

Completely untested: 

((derived-mode-p 'dired-mode)  (vc-responsible-backend default-directory))

C-x v g won't work either, vc-annotate seems to want to call
vc-ensure-vc-buffer for some reason.




^ 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).