[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Introducing 'unrecognized and 'ignored
From: |
Tom Tromey |
Subject: |
Re: Introducing 'unrecognized and 'ignored |
Date: |
Fri, 18 Jan 2008 23:00:06 -0700 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.990 (gnu/linux) |
>>>>> "Dan" == Dan Nicolaescu <address@hidden> 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 <address@hidden>
* 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'."
- Re: Introducing 'unrecognized and 'ignored, (continued)
- Re: Introducing 'unrecognized and 'ignored, Dan Nicolaescu, 2008/01/06
- Re: Introducing 'unrecognized and 'ignored, Tom Tromey, 2008/01/06
- Re: Introducing 'unrecognized and 'ignored, Stefan Monnier, 2008/01/06
- PCL-CVS buffers (was: Introducing 'unrecognized and 'ignored), Reiner Steib, 2008/01/07
- Re: PCL-CVS buffers, Stefan Monnier, 2008/01/07
- Re: Introducing 'unrecognized and 'ignored, Dan Nicolaescu, 2008/01/18
- Re: Introducing 'unrecognized and 'ignored, Tom Tromey, 2008/01/18
- Re: Introducing 'unrecognized and 'ignored, Dan Nicolaescu, 2008/01/18
- Re: Introducing 'unrecognized and 'ignored,
Tom Tromey <=
- Re: Introducing 'unrecognized and 'ignored, Dan Nicolaescu, 2008/01/19
- Re: Introducing 'unrecognized and 'ignored, Stefan Monnier, 2008/01/19
- Re: Introducing 'unrecognized and 'ignored, Thien-Thi Nguyen, 2008/01/19
- Re: Introducing 'unrecognized and 'ignored, Dan Nicolaescu, 2008/01/20
- Re: Introducing 'unrecognized and 'ignored, Thien-Thi Nguyen, 2008/01/21
- Re: Introducing 'unrecognized and 'ignored, Dan Nicolaescu, 2008/01/20
- Re: Introducing 'unrecognized and 'ignored, Tom Tromey, 2008/01/20
- Re: Introducing 'unrecognized and 'ignored, Stefan Monnier, 2008/01/20
- Re: Introducing 'unrecognized and 'ignored, Tom Tromey, 2008/01/20
- Re: Introducing 'unrecognized and 'ignored, Dan Nicolaescu, 2008/01/21