Patches 1-3 are an answer to a question on IRC: <ccxCZ> is there a way for notmuch search --output=files to only output one file for Message-ID instead of all? Yes, use --duplicate=0 on the command line. ;) I suggest this interface (instead of, say, --output=file1 which was also contemplated) for two reasons: it allows one to choose also other files than the first one, and the same interface could be used later on in notmuch show to display the duplicates. An alternative could be something like --duplicates=(all|first|rest) which would lack the possibility to pick a specific duplicate, but would allow one to list all the "redundant" files with --duplicates=rest (this would correspond to a number of invocations with --duplicate=1, --duplicate=2, etc.) Patches 4-6 add support for querying the file counts in notmuch count. Most useful with a single id:<message-id> query I presume. BR, Jani. Jani Nikula (6): cli: add --duplicate=N option to notmuch search test: test notmuch search --duplicate=N man: document notmuch search --duplicate=N cli: add --output=files option to notmuch count test: test notmuch count --output=files man: document notmuch count --output=files man/man1/notmuch-count.1 | 10 ++++++- man/man1/notmuch-search.1 | 11 ++++++++ notmuch-count.c | 37 ++++++++++++++++++++++++++ notmuch-search.c | 18 ++++++++----- test/count | 10 +++++++ test/search-output | 65 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 144 insertions(+), 7 deletions(-) -- 1.7.10.4