On Fri, 19 Aug 2011 17:00:23 +0200, Michal Sojka <[email protected]> wrote:
> If you really want this behavior, I propose to make the default value
> of notmuch-max-results infinity.

I'm attaching a revised patch that does as you suggest.  Thanks.

>From d0421e4308473347b31f5537eaec93b137084060 Mon Sep 17 00:00:00 2001
From: James Vasile <[email protected]>
Date: Sat, 20 Aug 2011 14:58:47 -0400
Subject: [PATCH] Limit number of threads returned by search in emacs

Set notmuch-max-results to the maximum number of results the
client should show.  Setting notmuch-max-results to 0 (the
default) does not limit search results (i.e. limits them to
infinity).

This patch requries your version of notmuch to implement the
--last-index parameter.  A patch to implement this parameter was
posted to the notmuch mailing list as
id:[email protected].
---
 emacs/notmuch.el |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index f11ec24..887d696 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -882,6 +882,7 @@ characters as well as `_.+-'.
 	   (concat "*notmuch-search-" query "*"))
 	  )))
 
+(defvar notmuch-max-results 0)
 ;;;###autoload
 (defun notmuch-search (query &optional oldest-first target-thread target-line continuation)
   "Run \"notmuch search\" with the given query string and display results.
@@ -913,6 +914,9 @@ The optional parameters are used as follows:
 	(let ((proc (start-process
 		     "notmuch-search" buffer
 		     notmuch-command "search"
+		     (if (> notmuch-max-results 0)
+			 (format "--last-index=%d" notmuch-max-results)
+			 "")
 		     (if oldest-first
 			 "--sort=oldest-first"
 		       "--sort=newest-first")
-- 
1.7.5.4

_______________________________________________
notmuch mailing list
[email protected]
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to