Hey hey :o)

I've just tried out the new feature of listing merged patches in the
missing buffer--very nice :o)  I noticed TLA--CAT-LOG-ANY runs tla
synchronously.  Are you still working on this Matthieu?  I've hacked up
an asynchronous version, but it's required a bit of messing around with
some of your new functions that could interfere with what you're
currently doing.  I'm also quite sick at the moment, so the cold
medication I'm taking might have addled my brain and made me write crazy
code.

What I've changed:

  ;; Modified to run asynchronously where ASYNC-CALLBACK is supplied.
  (defun tla--cat-log-any (revision &optional tree async-callback)
    [...]
    (let* ((version (butlast revision))
           (local-version (tla-tree-version-list
                           (or tree default-directory) t))
           (command (if (equal version local-version)
                        "cat-log" "cat-archive-log")))
      (if async-callback
          (tla--run-tla-async
           (list command (apply 'tla-name-construct-fully-qualified revision))
           :finished async-callback)
        (tla--run-tla-sync
         (list command (apply 'tla-name-construct-fully-qualified revision))
         :finished (lambda (output error status arguments)
                     (with-current-buffer output (clone-buffer)))))))


  ;; Modified to pass a callback to tla-log-merges.  This gets called
  ;; when the list of merged revisions has been "filled in".
  (defun tla--revisions-parse-list (type details merges buffer
                                         parent-node cookie)
  
          [...]
          (when tla-revisions-shows-merges
            (setq merges (tla-log-merges (tla-split-revision-name
                                          revision)
                                         `(lambda () (ewoc-refresh ,cookie)))))
          [...])

  ;; Modified to call tla--cat-log-any asynchronously and return a list
  ;; that is later mutated.
  (defun tla-log-merges (revision &optional callback)
    "Return a list that will contain patches merged by REVISION.  When the list
    has been filled in, CALLBACK is called with no arguments."
    (let ((merges (list "")))
      (tla--cat-log-any
       revision nil
       `(lambda (output error status args)
          (with-current-buffer output
            (goto-char (point-min))
            (unwind-protect
                (let ((list (split-string
                             (buffer-substring-no-properties
                              (re-search-forward "^New-patches: ")
                              (progn (re-search-forward "^[^\t ]")
                                     (beginning-of-line) (point))))))
                  (setq list
                        (remove (apply 'tla-name-construct-fully-qualified
                                       ',revision)
                                list))
                  (setcar ',merges (car list))
                  (setcdr ',merges (cdr list)))
              (when ',callback (funcall ',callback))
              (kill-buffer nil)))))
      merges))


Anyway, I just thought I'd send these as inspiration, or something :o)
If you're still working on this section of code I'll leave it alone
until you're done.

Take care,

Mark
  
-- 
Mark Triggs
<[EMAIL PROTECTED]>

Reply via email to