From d0421e4308473347b31f5537eaec93b137084060 Mon Sep 17 00:00:00 2001 From: James Vasile 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:8739gyw0zh.fsf@opensourcematters.org. --- 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