emacs: make elide messages use notmuch-show for omitting messages.

Previously the elide messages code got the entire-thread from
notmuch-show.c and then threw away all non-matching messages. This
version calls notmuch-show.c without the --entire-thread flag so
it never receives the non-matching messages in the first place.

This makes it substantially faster.
This commit is contained in:
Mark Walters 2012-06-16 11:21:46 +01:00 committed by David Bremner
parent fdce20d365
commit e12645c869

View file

@ -964,9 +964,9 @@ message at DEPTH in the current thread."
"Insert the message tree TREE at depth DEPTH in the current thread." "Insert the message tree TREE at depth DEPTH in the current thread."
(let ((msg (car tree)) (let ((msg (car tree))
(replies (cadr tree))) (replies (cadr tree)))
(if (or (not notmuch-show-elide-non-matching-messages) ;; We test whether there is a message or just some replies.
(plist-get msg :match)) (when msg
(notmuch-show-insert-msg msg depth)) (notmuch-show-insert-msg msg depth))
(notmuch-show-insert-thread replies (1+ depth)))) (notmuch-show-insert-thread replies (1+ depth))))
(defun notmuch-show-insert-thread (thread depth) (defun notmuch-show-insert-thread (thread depth)
@ -1047,16 +1047,18 @@ function is used."
(args (if notmuch-show-query-context (args (if notmuch-show-query-context
(append (list "\'") basic-args (append (list "\'") basic-args
(list "and (" notmuch-show-query-context ")\'")) (list "and (" notmuch-show-query-context ")\'"))
(append (list "\'") basic-args (list "\'"))))) (append (list "\'") basic-args (list "\'"))))
(notmuch-show-insert-forest (notmuch-query-get-threads (cli-args (cons "--exclude=false"
(cons "--exclude=false" args))) (when notmuch-show-elide-non-matching-messages
(list "--entire-thread=false")))))
(notmuch-show-insert-forest (notmuch-query-get-threads (append cli-args args)))
;; If the query context reduced the results to nothing, run ;; If the query context reduced the results to nothing, run
;; the basic query. ;; the basic query.
(when (and (eq (buffer-size) 0) (when (and (eq (buffer-size) 0)
notmuch-show-query-context) notmuch-show-query-context)
(notmuch-show-insert-forest (notmuch-show-insert-forest
(notmuch-query-get-threads (notmuch-query-get-threads (append cli-args basic-args)))))
(cons "--exclude=false" basic-args)))))
(jit-lock-register #'notmuch-show-buttonise-links) (jit-lock-register #'notmuch-show-buttonise-links)