[PATCH 2/2] emacs: make elide messages use notmuch-show for omitting messages.

Mark Walters markwalters1009 at gmail.com
Thu Feb 23 13:41:34 PST 2012


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.
---
 emacs/notmuch-show.el |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index dcef3d5..e368363 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -981,9 +981,10 @@ current buffer, if possible."
   "Insert the message tree TREE at depth DEPTH in the current thread."
   (let ((msg (car tree))
 	(replies (cadr tree)))
-    (if (or (not notmuch-show-elide-non-matching-messages)
-	    (plist-get msg :match))
-	(notmuch-show-insert-msg msg depth))
+    ;; We test whether there is a message or just some replies.
+    (if (eq (length tree) 2)
+	(notmuch-show-insert-msg msg depth)
+      (setq replies msg))
     (notmuch-show-insert-thread replies (1+ depth))))
 
 (defun notmuch-show-insert-thread (thread depth)
@@ -1064,7 +1065,8 @@ function is used."
 		       (append (list "\'") basic-args
 			       (list "and (" notmuch-show-query-context ")\'"))
 		     (append (list "\'") basic-args (list "\'"))))
-	     (cli-args (list "--entire-thread")))
+	     (cli-args (unless notmuch-show-elide-non-matching-messages
+			 (list "--entire-thread"))))
 	(notmuch-show-insert-forest (notmuch-query-get-threads (append cli-args args)))
 	;; If the query context reduced the results to nothing, run
 	;; the basic query.
-- 
1.7.2.3



More information about the notmuch mailing list