t))
(defun notmuch-pick-message-window-kill-hook ()
+ "Close the message pane when exiting the show buffer."
(let ((buffer (current-buffer)))
(when (and (window-live-p notmuch-pick-message-window)
(eq (window-buffer notmuch-pick-message-window) buffer))
(notmuch-pick-show-message)))))
(defun notmuch-pick-insert-tree (tree depth tree-status first last)
- "Insert the message tree TREE at depth DEPTH in the current thread."
+ "Insert the message tree TREE at depth DEPTH in the current thread.
+
+A message tree is another name for a single sub-thread: i.e., a
+message together with all its descendents."
(let ((msg (car tree))
(replies (cadr tree)))
(notmuch-pick-insert-thread replies (1+ depth) tree-status)))
(defun notmuch-pick-insert-thread (thread depth tree-status)
- "Insert the thread THREAD at depth DEPTH >= 1 in the current forest."
+ "Insert the collection of sibling sub-threads THREAD at depth DEPTH in the current forest."
(let ((n (length thread)))
(loop for tree in thread
for count from 1 to n
do (notmuch-pick-insert-tree tree depth tree-status (eq count 1) (eq count n)))))
(defun notmuch-pick-insert-forest-thread (forest-thread)
+ "Insert a single complete thread."
(let (tree-status)
;; Reset at the start of each main thread.
(setq notmuch-pick-previous-subject nil)
(notmuch-pick-insert-thread forest-thread 0 tree-status)))
(defun notmuch-pick-insert-forest (forest)
+ "Insert a forest of threads.
+
+This function inserts a collection of several complete threads as
+passed to it by notmuch-pick-process-filter."
(mapc 'notmuch-pick-insert-forest-thread forest))
(defun notmuch-pick-mode ()
(if (equal (car (process-lines notmuch-command "count" search-args)) "0")
(setq search-args basic-query))
(if notmuch-pick-asynchronous-parser
- (let ((proc (start-process
- "notmuch-pick" buffer
- notmuch-command "show" "--body=false" "--format=sexp"
+ (let ((proc (notmuch-start-notmuch
+ "notmuch-pick" buffer #'notmuch-pick-process-sentinel
+ "show" "--body=false" "--format=sexp"
message-arg search-args))
;; Use a scratch buffer to accumulate partial output.
;; This buffer will be killed by the sentinel, which
;; should be called no matter how the process dies.
(parse-buf (generate-new-buffer " *notmuch pick parse*")))
(process-put proc 'parse-buf parse-buf)
- (set-process-sentinel proc 'notmuch-pick-process-sentinel)
(set-process-filter proc 'notmuch-pick-process-filter)
(set-process-query-on-exit-flag proc nil))
(progn