Hi, here's the third version of my output limiting patches. Changes since v2 (id:"cover.1320093940.git.jani@nikula.org"): * lib: use NOTMUCH_SORT_UNSORTED for notmuch_query_count_threads() query * cli: maxitems=0 doesn't output anything (previously it was unlimited) * cli: add --output=threads support for notmuch count * cli: some minor cleanups * test: add tests for notmuch count and search with limits Unfortunately I noticed patch 7 is BROKEN, but I'm sending these now anyway because I think patches 1-6 are good stuff and I don't have the time to fix 7 for some days. BR, Jani. PS. This is broken in patch 7: + (if (and maxitems (< 0 maxitems)) + (if oldest-first + (format "--first=-%d" maxitems) + (format "--maxitems=%d" maxitems)) + "") It should produce neither nil nor "" when (and maxitems (< 0 maxitems)) is nil. Jani Nikula (7): lib: add function to get the number of threads matching a search cli: add options --first and --maxitems to notmuch search cli: drop unused code from notmuch count cli: add support for --output parameter in notmuch count test: add tests for notmuch count test: add tests for notmuch search --first and --maxitems emacs: support limiting the number of results shown in search results emacs/notmuch-hello.el | 17 +++++++++-- emacs/notmuch.el | 53 ++++++++++++++++++++++++++++++++--- lib/notmuch.h | 14 +++++++++ lib/query.cc | 44 +++++++++++++++++++++++++++++ notmuch-count.c | 44 +++++++++--------------------- notmuch-search.c | 70 +++++++++++++++++++++++++++++++++++++++-------- test/count | 40 +++++++++++++++++++++++++++ test/notmuch-test | 2 + test/search-limiting | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 304 insertions(+), 51 deletions(-) create mode 100755 test/count create mode 100755 test/search-limiting -- 1.7.5.4