all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Dan Nicolaescu <dann@ics.uci.edu>
Cc: esr@thyrsus.com, harsanyi@mac.com, rms@gnu.org,
	monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: Introducing 'unrecognized and 'ignored
Date: Fri, 18 Jan 2008 23:00:06 -0700	[thread overview]
Message-ID: <m3prvy5p95.fsf@fleche.redhat.com> (raw)
In-Reply-To: <200801182346.m0INkiEg022130@sallyv1.ics.uci.edu> (Dan Nicolaescu's message of "Fri\, 18 Jan 2008 15\:46\:39 -0800")

>>>>> "Dan" == Dan Nicolaescu <dann@ics.uci.edu> writes:

Dan> But it needs to be updated to work with the asynchronous
Dan> interface. Can you please do that?

Here's a patch.

I'm not really sure about using generate-new-buffer-name here.
Presumably each vc-status buffer should have a single vc "work" buffer
as well.

After trying this a couple times, I think the user needs an indication
of whether anything is running.  pcl-cvs puts this nicely in the
buffer... anyway, if you run vc-status on a directory with no changes,
it can be a little confusing as-is.

Finally, I wonder if it makes sense to call the callback with partial
results, and build up the buffer contents incrementally.  With large
directories, both pcl-cvs and psvn pause noticeably when "rendering".
I suppose this would only help if the underlying tool works this way
itself.

Tom

ChangeLog:
2008-01-19  Tom Tromey  <tromey@redhat.com>

	* vc-svn.el (vc-svn-after-dir-status): New function.
	(vc-svn-dir-status): Run svn asynchronously.

Index: vc-svn.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/vc-svn.el,v
retrieving revision 1.64
diff -u -r1.64 vc-svn.el
--- vc-svn.el	18 Jan 2008 23:45:03 -0000	1.64
+++ vc-svn.el	19 Jan 2008 06:30:23 -0000
@@ -158,28 +158,34 @@
       (vc-svn-command t 0 nil "status" (if localp "-v" "-u"))
       (vc-svn-parse-status))))
 
-(defun vc-svn-dir-status (dir)
-  "Return a list of conses (FILE . STATE) for DIR."
-  (with-temp-buffer
-    (let ((default-directory (file-name-as-directory dir))
-	  (state-map '((?A . added)
-		       (?C . edited)
-		       (?D . removed)
-		       (?I . ignored)
-		       (?M . edited)
-		       (?R . removed)
-		       (?? . unregistered)
-		       ;; This is what vc-svn-parse-status does.
-		       (?~ . edited)))
-	  result)
-      (vc-svn-command t 0 nil "status")
-      (goto-char (point-min))
-      (while (re-search-forward "^\\(.\\)..... \\(.*\\)$" nil t)
-	(let ((state (cdr (assq (aref (match-string 1) 0) state-map)))
-	      (filename (match-string 2)))
-	  (when state
-	    (setq result (cons (cons filename state) result)))))
-      result)))
+(defun vc-svn-after-dir-status (callback buffer)
+  (let ((state-map '((?A . added)
+		     (?C . edited)
+		     (?D . removed)
+		     (?I . ignored)
+		     (?M . edited)
+		     (?R . removed)
+		     (?? . unregistered)
+		     ;; This is what vc-svn-parse-status does.
+		     (?~ . edited)))
+	result)
+    (goto-char (point-min))
+    (while (re-search-forward "^\\(.\\)..... \\(.*\\)$" nil t)
+      (let ((state (cdr (assq (aref (match-string 1) 0) state-map)))
+	    (filename (match-string 2)))
+	(when state
+	  (setq result (cons (cons filename state) result)))))
+    (funcall callback result buffer)))
+
+(defun vc-svn-dir-status (dir callback buffer)
+  "Run 'svn status' for DIR and update BUFFER via CALLBACK.
+CALLBACK is called as (CALLBACK RESULT BUFFER), where
+RESULT is a list of conses (FILE . STATE) for directory DIR."
+  (with-current-buffer (get-buffer-create
+			(generate-new-buffer-name " *vc svn status*"))
+    (vc-svn-command (current-buffer) 'async nil "status")
+    (vc-exec-after
+     `(vc-svn-after-dir-status (quote ,callback) ,buffer))))
 
 (defun vc-svn-working-revision (file)
   "SVN-specific version of `vc-working-revision'."

  parent reply	other threads:[~2008-01-19  6:00 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-28 17:45 Introducing 'unrecognized and 'ignored Eric S. Raymond
2007-12-28 23:01 ` Dan Nicolaescu
2007-12-29  2:48 ` Alexandru Harsanyi
2007-12-29 11:45   ` Eric S. Raymond
2008-01-02  2:02     ` Stefan Monnier
2008-01-02  2:19       ` Eric S. Raymond
2008-01-02  4:16         ` Stefan Monnier
2008-01-02  4:45           ` Dan Nicolaescu
2008-01-02 11:50             ` Eric S. Raymond
2008-01-02 17:31               ` Dan Nicolaescu
2008-01-03  9:50             ` Richard Stallman
2008-01-03 18:05               ` Dan Nicolaescu
2008-01-03 18:19                 ` Eric S. Raymond
2008-01-05  5:54                 ` Richard Stallman
2008-01-05  9:01                   ` Dan Nicolaescu
2008-01-05 14:34                     ` Eric S. Raymond
2008-01-05 22:25                       ` Stefan Monnier
2008-01-06 10:37                       ` Dan Nicolaescu
2008-01-06 15:57                         ` Eric S. Raymond
2008-01-18 23:31                           ` Dan Nicolaescu
2008-01-06 20:00                         ` Tom Tromey
2008-01-06 21:03                           ` Stefan Monnier
2008-01-07  2:59                             ` Dan Nicolaescu
2008-01-07  3:26                               ` Eric S. Raymond
2008-01-07  3:36                                 ` Dan Nicolaescu
2008-01-07  3:59                                 ` Stefan Monnier
2008-01-07 12:56                                   ` Eric S. Raymond
2008-01-07 15:31                                     ` Stefan Monnier
2008-01-07 11:30                                 ` Richard Stallman
2008-01-07 12:54                                   ` Eric S. Raymond
2008-01-07 15:32                                     ` Stefan Monnier
2008-01-08 19:06                                     ` Richard Stallman
2008-01-08 19:34                                       ` Miles Bader
2008-01-07  3:22                           ` Dan Nicolaescu
2008-01-07  3:03                             ` Tom Tromey
2008-01-07  4:01                               ` Stefan Monnier
2008-01-07 21:15                                 ` PCL-CVS buffers (was: Introducing 'unrecognized and 'ignored) Reiner Steib
2008-01-08  2:33                                   ` PCL-CVS buffers Stefan Monnier
2008-01-18 23:46                           ` Introducing 'unrecognized and 'ignored Dan Nicolaescu
2008-01-19  0:10                             ` Tom Tromey
2008-01-19  1:20                               ` Dan Nicolaescu
2008-01-19  6:00                             ` Tom Tromey [this message]
2008-01-19 17:05                               ` Dan Nicolaescu
2008-01-19 19:40                                 ` Stefan Monnier
2008-01-19 21:01                                   ` Thien-Thi Nguyen
2008-01-20 17:18                                     ` Dan Nicolaescu
2008-01-20 20:24                                       ` Thien-Thi Nguyen
2008-01-20 17:08                                   ` Dan Nicolaescu
2008-01-20 19:08                                   ` Tom Tromey
2008-01-20 20:14                                     ` Stefan Monnier
2008-01-20 19:45                                       ` Tom Tromey
2008-01-22  1:35                                         ` Dan Nicolaescu
2008-01-19 20:03                                 ` Thien-Thi Nguyen
2008-01-20 19:24                                   ` Stefan Monnier
2008-01-20 20:30                                     ` Thien-Thi Nguyen
2008-01-21 15:18                                       ` Stefan Monnier
2008-01-21 15:30                                         ` Dan Nicolaescu
2008-01-21 15:56                                           ` Stefan Monnier
2008-01-21 15:34                                         ` Thien-Thi Nguyen
2008-01-06  8:09                     ` Richard Stallman
2008-01-02 11:46           ` Eric S. Raymond
2008-01-02 20:38             ` Stefan Monnier
2008-01-02 22:11               ` Eric S. Raymond
2008-01-02 23:06                 ` Stefan Monnier
2008-01-02 23:29                   ` Eric S. Raymond
2008-01-03 14:30                     ` Stefan Monnier
2008-01-03 17:41                       ` Eric S. Raymond
2008-01-05  5:54                         ` Richard Stallman
2008-01-02 23:13                 ` Dan Nicolaescu
2008-01-02 23:33                   ` Eric S. Raymond

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=m3prvy5p95.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=dann@ics.uci.edu \
    --cc=emacs-devel@gnu.org \
    --cc=esr@thyrsus.com \
    --cc=harsanyi@mac.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=rms@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.