emacs-devel
[Top][All Lists]
Advanced

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

Re: Patch to make VC annotate async


From: Stefan Monnier
Subject: Re: Patch to make VC annotate async
Date: Sat, 07 Jul 2007 17:06:57 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

For the vc-cvs.el part of the patch , can you try the patch below?
Also I noticed that my own version used vc-exec-after because that makes it
work both for async and sync and I select between the two with

  (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0)

Not sure if it matters.


        Stefan


--- vc-cvs.el   26 jan 2007 23:51:27 -0500      1.80
+++ vc-cvs.el   07 jui 2007 17:00:40 -0400      
@@ -588,14 +591,22 @@
                (and rev2 (concat "-r" rev2))
                (vc-switches 'CVS 'diff))))))
 
+(defun vc-cvs-annotate-process-filter (process string)
+  (setq string (concat (process-get process 'output) string))
+  (if (not (string-match "^[0-9]" string))
+      ;; Still waiting for the first real line.
+      (process-put process 'output string)
+    ;; FIXME: we shouldn't hardcode vc-process-filter here.
+    (set-process-filter process 'vc-process-filter)
+    (vc-process-filter process (substring string (match-beginning 0)))))
+
 (defun vc-cvs-annotate-command (file buffer &optional version)
   "Execute \"cvs annotate\" on FILE, inserting the contents in BUFFER.
 Optional arg VERSION is a version to annotate from."
-  (vc-cvs-command buffer 0 file "annotate" (if version (concat "-r" version)))
-  (with-current-buffer buffer
-    (goto-char (point-min))
-    (re-search-forward "^[0-9]")
-    (delete-region (point-min) (1- (point)))))
+  (vc-cvs-command buffer 'async file "annotate"
+                  (if version (concat "-r" version)))
+  (set-process-filter (get-buffer-process buffer)
+                     'vc-cvs-annotate-process-filter))
 
 (defun vc-cvs-annotate-current-time ()
   "Return the current time, based at midnight of the current day, and




reply via email to

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