[PATCH] Return maximum of 150 results

James Vasile james at hackervisions.org
Thu Aug 18 20:15:55 PDT 2011


Display a maximum of 150 results when searching for messages.  This
prevents client lag when searches return thousands of results you'll
never look at (use the Filter command to cut down results that exceed
150).

Number of results can be changed by setting notmuch-max-results.

This patch depends on notmuch supporting the --last-index option, a
patch for which I emailed to the list earlier this evening.
---
 emacs/notmuch.el |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 2f36bbd..b928680 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -1944,6 +1944,7 @@ characters as well as `_.+-'.
     (apply 'notmuch-enqueue-asynch "tag"
 	   (append action-split (list notmuch-search-query-string) nil))))
 
+(defvar notmuch-max-results 150)
 ;;;###autoload
 (defun notmuch-search (query &optional oldest-first target-thread target-line continuation)
   "Run \"notmuch search\" with the given query string and display results.
@@ -1975,6 +1976,7 @@ The optional parameters are used as follows:
 	(let ((proc (start-process
 		     "notmuch-search" buffer
 		     notmuch-command "search"
+		     (concat "--last-index=" (number-to-string notmuch-max-results))
 		     (if oldest-first
 			 "--sort=oldest-first"
 		       "--sort=newest-first")
-- 
1.7.5.4



More information about the notmuch mailing list