--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 17B04431FAF\r
+ for <notmuch@notmuchmail.org>; Wed, 5 Nov 2014 03:23:24 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id ITe7t+CQoaoi for <notmuch@notmuchmail.org>;\r
+ Wed, 5 Nov 2014 03:23:20 -0800 (PST)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id B3ECC431FAE\r
+ for <notmuch@notmuchmail.org>; Wed, 5 Nov 2014 03:23:19 -0800 (PST)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1Xlyfx-00068v-1Q; Wed, 05 Nov 2014 11:23:17 +0000\r
+Received: from 5751dfa2.skybroadband.com ([87.81.223.162] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1Xlyfw-00089K-Cz; Wed, 05 Nov 2014 11:22:56 +0000\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Michal Sojka <sojkam1@fel.cvut.cz>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2 06/10] cli: Introduce "notmuch address" command\r
+In-Reply-To: <87y4rqliid.fsf@steelpick.2x.cz>\r
+References: <1415058622-21162-1-git-send-email-sojkam1@fel.cvut.cz>\r
+ <1415058622-21162-7-git-send-email-sojkam1@fel.cvut.cz>\r
+ <87zjc72v79.fsf@qmul.ac.uk> <87y4rqliid.fsf@steelpick.2x.cz>\r
+User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Wed, 05 Nov 2014 11:22:55 +0000\r
+Message-ID: <87d291ao34.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 87.81.223.162\r
+X-QM-Geographic: According to ripencc,\r
+ this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: e80ff01187d318b6c6ef296f25efa8c2 (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.1\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -0.1 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * -0.1 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 05 Nov 2014 11:23:24 -0000\r
+\r
+On Tue, 04 Nov 2014, Michal Sojka <sojkam1@fel.cvut.cz> wrote:\r
+> On Tue, Nov 04 2014, Mark Walters wrote:\r
+>> On Mon, 03 Nov 2014, Michal Sojka <sojkam1@fel.cvut.cz> wrote:\r
+>>> This moves address-related functionality from search command to the\r
+>>> new address command. The implementation shares almost all code and\r
+>>> some command line options.\r
+>>>\r
+>>> Options --offset and --limit were intentionally not included in the\r
+>>> address command, because they refer to messages numbers, which users\r
+>>> do not see in the output. This could confuse users because, for\r
+>>> example, they could see more addresses in the output that what was\r
+>>> specified with --limit. This functionality can be correctly\r
+>>> reimplemented for addresses later.\r
+>>\r
+>> I am not sure about this: we already have this anomaly for output=files\r
+>> say. Also I can imagine calling notmuch address --limit=1000 ... to get\r
+>> a bunch of recent addresses quickly and I really am wanting to look at\r
+>> 1000 messages, not collect 1000 addresses.\r
+>\r
+> I think that one of the reasons for having the new "address" command is\r
+> to have cleaner user interface. And including "anomalies" doesn't sound\r
+> like a way to achieve this. I think that now you can use "date:" query\r
+> to limit the search.\r
+>\r
+> I volunteer to implement "address --limit" properly after 0.19. This\r
+> should be easy.\r
+\r
+I think this depends on how you view limit: is it to limit the output\r
+(roughly to run "head" on the output), or is to bound the amount of work\r
+notmuch has to do (eg to make sure you don't get a long delay). Your\r
+suggestion is definitely the former, whereas I am more worried about the\r
+latter: limit in your definition could take an essentially unbounded\r
+amount of time.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+>\r
+> -Michal\r
+>\r
+>> Additionally, the 1000 message approach makes sense when we start\r
+>> deduping whereas 1000 authors becomes unclear.\r
+>>\r
+>>>\r
+>>> This was inspired by a patch from Jani Nikula.\r
+>>> ---\r
+>>> completion/notmuch-completion.bash | 42 ++++++++++++++-\r
+>>> completion/notmuch-completion.zsh | 10 +++-\r
+>>> doc/man1/notmuch-address.rst | 99 ++++++++++++++++++++++++++++++++++++\r
+>>> doc/man1/notmuch-search.rst | 20 +-------\r
+>>> doc/man1/notmuch.rst | 7 +--\r
+>>> notmuch-client.h | 3 ++\r
+>>> notmuch-search.c | 101 +++++++++++++++++++++++++------------\r
+>>> notmuch.c | 2 +\r
+>>> 8 files changed, 228 insertions(+), 56 deletions(-)\r
+>>> create mode 100644 doc/man1/notmuch-address.rst\r
+>>>\r
+>>> diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash\r
+>>> index cfbd389..94ea2d5 100644\r
+>>> --- a/completion/notmuch-completion.bash\r
+>>> +++ b/completion/notmuch-completion.bash\r
+>>> @@ -294,7 +294,7 @@ _notmuch_search()\r
+>>> return\r
+>>> ;;\r
+>>> --output)\r
+>>> - COMPREPLY=( $( compgen -W "summary threads messages files tags sender recipients" -- "${cur}" ) )\r
+>>> + COMPREPLY=( $( compgen -W "summary threads messages files tags" -- "${cur}" ) )\r
+>>> return\r
+>>> ;;\r
+>>> --sort)\r
+>>> @@ -320,6 +320,44 @@ _notmuch_search()\r
+>>> esac\r
+>>> }\r
+>>> \r
+>>> +_notmuch_address()\r
+>>> +{\r
+>>> + local cur prev words cword split\r
+>>> + _init_completion -s || return\r
+>>> +\r
+>>> + $split &&\r
+>>> + case "${prev}" in\r
+>>> + --format)\r
+>>> + COMPREPLY=( $( compgen -W "json sexp text text0" -- "${cur}" ) )\r
+>>> + return\r
+>>> + ;;\r
+>>> + --output)\r
+>>> + COMPREPLY=( $( compgen -W "sender recipients" -- "${cur}" ) )\r
+>>> + return\r
+>>> + ;;\r
+>>> + --sort)\r
+>>> + COMPREPLY=( $( compgen -W "newest-first oldest-first" -- "${cur}" ) )\r
+>>> + return\r
+>>> + ;;\r
+>>> + --exclude)\r
+>>> + COMPREPLY=( $( compgen -W "true false flag all" -- "${cur}" ) )\r
+>>> + return\r
+>>> + ;;\r
+>>> + esac\r
+>>> +\r
+>>> + ! $split &&\r
+>>> + case "${cur}" in\r
+>>> + -*)\r
+>>> + local options="--format= --output= --sort= --exclude="\r
+>>> + compopt -o nospace\r
+>>> + COMPREPLY=( $(compgen -W "$options" -- ${cur}) )\r
+>>> + ;;\r
+>>> + *)\r
+>>> + _notmuch_search_terms\r
+>>> + ;;\r
+>>> + esac\r
+>>> +}\r
+>>> +\r
+>>> _notmuch_show()\r
+>>> {\r
+>>> local cur prev words cword split\r
+>>> @@ -393,7 +431,7 @@ _notmuch_tag()\r
+>>> \r
+>>> _notmuch()\r
+>>> {\r
+>>> - local _notmuch_commands="compact config count dump help insert new reply restore search setup show tag"\r
+>>> + local _notmuch_commands="compact config count dump help insert new reply restore search address setup show tag"\r
+>>> local arg cur prev words cword split\r
+>>> \r
+>>> # require bash-completion with _init_completion\r
+>>> diff --git a/completion/notmuch-completion.zsh b/completion/notmuch-completion.zsh\r
+>>> index 3e52a00..c606b75 100644\r
+>>> --- a/completion/notmuch-completion.zsh\r
+>>> +++ b/completion/notmuch-completion.zsh\r
+>>> @@ -10,6 +10,7 @@ _notmuch_commands()\r
+>>> 'setup:interactively set up notmuch for first use'\r
+>>> 'new:find and import any new message to the database'\r
+>>> 'search:search for messages matching the search terms, display matching threads as results'\r
+>>> + 'address:get addresses from messages matching the given search terms'\r
+>>> 'reply:constructs a reply template for a set of messages'\r
+>>> 'show:show all messages matching the search terms'\r
+>>> 'tag:add or remove tags for all messages matching the search terms'\r
+>>> @@ -53,7 +54,14 @@ _notmuch_search()\r
+>>> '--max-threads=[display only the first x threads from the search results]:number of threads to show: ' \\r
+>>> '--first=[omit the first x threads from the search results]:number of threads to omit: ' \\r
+>>> '--sort=[sort results]:sorting:((newest-first\:"reverse chronological order" oldest-first\:"chronological order"))' \\r
+>>> - '--output=[select what to output]:output:((summary threads messages files tags sender recipients))'\r
+>>> + '--output=[select what to output]:output:((summary threads messages files tags))'\r
+>>> +}\r
+>>> +\r
+>>> +_notmuch_address()\r
+>>> +{\r
+>>> + _arguments -s : \\r
+>>> + '--sort=[sort results]:sorting:((newest-first\:"reverse chronological order" oldest-first\:"chronological order"))' \\r
+>>> + '--output=[select what to output]:output:((sender recipients))'\r
+>>> }\r
+>>> \r
+>>> _notmuch()\r
+>>> diff --git a/doc/man1/notmuch-address.rst b/doc/man1/notmuch-address.rst\r
+>>> new file mode 100644\r
+>>> index 0000000..8109f11\r
+>>> --- /dev/null\r
+>>> +++ b/doc/man1/notmuch-address.rst\r
+>>> @@ -0,0 +1,99 @@\r
+>>> +===============\r
+>>> +notmuch-address\r
+>>> +===============\r
+>>> +\r
+>>> +SYNOPSIS\r
+>>> +========\r
+>>> +\r
+>>> +**notmuch** **address** [*option* ...] <*search-term*> ...\r
+>>> +\r
+>>> +DESCRIPTION\r
+>>> +===========\r
+>>> +\r
+>>> +Search for messages matching the given search terms, and display the\r
+>>> +addresses from them.\r
+>>> +\r
+>>> +See **notmuch-search-terms(7)** for details of the supported syntax for\r
+>>> +<search-terms>.\r
+>>> +\r
+>>> +Supported options for **address** include\r
+>>> +\r
+>>> + ``--format=``\ (**json**\ \|\ **sexp**\ \|\ **text**\ \|\ **text0**)\r
+>>> + Presents the results in either JSON, S-Expressions, newline\r
+>>> + character separated plain-text (default), or null character\r
+>>> + separated plain-text (compatible with **xargs(1)** -0 option\r
+>>> + where available).\r
+>>> +\r
+>>> + ``--format-version=N``\r
+>>> + Use the specified structured output format version. This is\r
+>>> + intended for programs that invoke **notmuch(1)** internally. If\r
+>>> + omitted, the latest supported version will be used.\r
+>>> +\r
+>>> + ``--output=(sender|recipients)``\r
+>>> +\r
+>>> + Controls which information appears in the output. This option\r
+>>> + can be given multiple times to combine different outputs.\r
+>>> + Omitting this option is equivalent to\r
+>>> + --output=sender --output=recipients.\r
+>>> +\r
+>>> + **sender**\r
+>>> + Output all addresses from the *From* header.\r
+>>> +\r
+>>> + Note: Searching for **sender** should be much faster than\r
+>>> + searching for **recipients**, because sender addresses are\r
+>>> + cached directly in the database whereas other addresses\r
+>>> + need to be fetched from message files.\r
+>>> +\r
+>>> + **recipients**\r
+>>> + Output all addresses from the *To*, *Cc* and *Bcc*\r
+>>> + headers.\r
+>>> +\r
+>>> + ``--sort=``\ (**newest-first**\ \|\ **oldest-first**)\r
+>>> + This option can be used to present results in either\r
+>>> + chronological order (**oldest-first**) or reverse chronological\r
+>>> + order (**newest-first**).\r
+>>> +\r
+>>> + By default, results will be displayed in reverse chronological\r
+>>> + order, (that is, the newest results will be displayed first).\r
+>>> +\r
+>>> + ``--exclude=(true|false|all|flag)``\r
+>>> + A message is called "excluded" if it matches at least one tag in\r
+>>> + search.tag\_exclude that does not appear explicitly in the\r
+>>> + search terms. This option specifies whether to omit excluded\r
+>>> + messages in the search process.\r
+>>> +\r
+>>> + The default value, **true**, prevents excluded messages from\r
+>>> + matching the search terms.\r
+>>> +\r
+>>> + **all** additionally prevents excluded messages from appearing\r
+>>> + in displayed results, in effect behaving as though the excluded\r
+>>> + messages do not exist.\r
+>>> +\r
+>>> + **false** allows excluded messages to match search terms and\r
+>>> + appear in displayed results. Excluded messages are still marked\r
+>>> + in the relevant outputs.\r
+>>> +\r
+>>> + **flag** only has an effect when ``--output=summary``. The\r
+>>> + output is almost identical to **false**, but the "match count"\r
+>>> + is the number of matching non-excluded messages in the thread,\r
+>>> + rather than the number of matching messages.\r
+>>\r
+>> The exclude text needs updating as flag makes no sense for the address\r
+>> command. \r
+>>\r
+>> Best wishes \r
+>>\r
+>> Mark\r
+>>\r
+>>> +EXIT STATUS\r
+>>> +===========\r
+>>> +\r
+>>> +This command supports the following special exit status codes\r
+>>> +\r
+>>> +``20``\r
+>>> + The requested format version is too old.\r
+>>> +\r
+>>> +``21``\r
+>>> + The requested format version is too new.\r
+>>> +\r
+>>> +SEE ALSO\r
+>>> +========\r
+>>> +\r
+>>> +**notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**,\r
+>>> +**notmuch-dump(1)**, **notmuch-hooks(5)**, **notmuch-insert(1)**,\r
+>>> +**notmuch-new(1)**, **notmuch-reply(1)**, **notmuch-restore(1)**,\r
+>>> +**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**,\r
+>>> +***notmuch-search(1)**\r
+>>> diff --git a/doc/man1/notmuch-search.rst b/doc/man1/notmuch-search.rst\r
+>>> index 8110086..65df288 100644\r
+>>> --- a/doc/man1/notmuch-search.rst\r
+>>> +++ b/doc/man1/notmuch-search.rst\r
+>>> @@ -78,25 +78,8 @@ Supported options for **search** include\r
+>>> by null characters (--format=text0), as a JSON array\r
+>>> (--format=json), or as an S-Expression list (--format=sexp).\r
+>>> \r
+>>> - **sender**\r
+>>> - Output all addresses from the *From* header that appear on\r
+>>> - any message matching the search terms, either one per line\r
+>>> - (--format=text), separated by null characters\r
+>>> - (--format=text0), as a JSON array (--format=json), or as\r
+>>> - an S-Expression list (--format=sexp).\r
+>>> -\r
+>>> - Note: Searching for **sender** should be much faster than\r
+>>> - searching for **recipients**, because sender addresses are\r
+>>> - cached directly in the database whereas other addresses\r
+>>> - need to be fetched from message files.\r
+>>> -\r
+>>> - **recipients**\r
+>>> - Like **sender** but for addresses from *To*, *Cc* and\r
+>>> - *Bcc* headers.\r
+>>> -\r
+>>> This option can be given multiple times to combine different\r
+>>> - outputs. Currently, this is only supported for **sender** and\r
+>>> - **recipients** outputs.\r
+>>> + outputs.\r
+>>> \r
+>>> ``--sort=``\ (**newest-first**\ \|\ **oldest-first**)\r
+>>> This option can be used to present results in either\r
+>>> @@ -173,3 +156,4 @@ SEE ALSO\r
+>>> **notmuch-dump(1)**, **notmuch-hooks(5)**, **notmuch-insert(1)**,\r
+>>> **notmuch-new(1)**, **notmuch-reply(1)**, **notmuch-restore(1)**,\r
+>>> **notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**\r
+>>> +***notmuch-address(1)**\r
+>>> diff --git a/doc/man1/notmuch.rst b/doc/man1/notmuch.rst\r
+>>> index 9710294..98590a4 100644\r
+>>> --- a/doc/man1/notmuch.rst\r
+>>> +++ b/doc/man1/notmuch.rst\r
+>>> @@ -88,8 +88,8 @@ Several of the notmuch commands accept search terms with a common\r
+>>> syntax. See **notmuch-search-terms**\ (7) for more details on the\r
+>>> supported syntax.\r
+>>> \r
+>>> -The **search**, **show** and **count** commands are used to query the\r
+>>> -email database.\r
+>>> +The **search**, **show**, **address** and **count** commands are used\r
+>>> +to query the email database.\r
+>>> \r
+>>> The **reply** command is useful for preparing a template for an email\r
+>>> reply.\r
+>>> @@ -128,7 +128,8 @@ SEE ALSO\r
+>>> **notmuch-config(1)**, **notmuch-count(1)**, **notmuch-dump(1)**,\r
+>>> **notmuch-hooks(5)**, **notmuch-insert(1)**, **notmuch-new(1)**,\r
+>>> **notmuch-reply(1)**, **notmuch-restore(1)**, **notmuch-search(1)**,\r
+>>> -**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**\r
+>>> +**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**,\r
+>>> +***notmuch-address(1)**\r
+>>> \r
+>>> The notmuch website: **http://notmuchmail.org**\r
+>>> \r
+>>> diff --git a/notmuch-client.h b/notmuch-client.h\r
+>>> index e1efbe0..5e0d475 100644\r
+>>> --- a/notmuch-client.h\r
+>>> +++ b/notmuch-client.h\r
+>>> @@ -199,6 +199,9 @@ int\r
+>>> notmuch_search_command (notmuch_config_t *config, int argc, char *argv[]);\r
+>>> \r
+>>> int\r
+>>> +notmuch_address_command (notmuch_config_t *config, int argc, char *argv[]);\r
+>>> +\r
+>>> +int\r
+>>> notmuch_setup_command (notmuch_config_t *config, int argc, char *argv[]);\r
+>>> \r
+>>> int\r
+>>> diff --git a/notmuch-search.c b/notmuch-search.c\r
+>>> index f115359..cbd84f5 100644\r
+>>> --- a/notmuch-search.c\r
+>>> +++ b/notmuch-search.c\r
+>>> @@ -23,17 +23,18 @@\r
+>>> #include "string-util.h"\r
+>>> \r
+>>> typedef enum {\r
+>>> + /* Search command */\r
+>>> OUTPUT_SUMMARY = 1 << 0,\r
+>>> OUTPUT_THREADS = 1 << 1,\r
+>>> OUTPUT_MESSAGES = 1 << 2,\r
+>>> OUTPUT_FILES = 1 << 3,\r
+>>> OUTPUT_TAGS = 1 << 4,\r
+>>> +\r
+>>> + /* Address command */\r
+>>> OUTPUT_SENDER = 1 << 5,\r
+>>> OUTPUT_RECIPIENTS = 1 << 6,\r
+>>> } output_t;\r
+>>> \r
+>>> -#define OUTPUT_ADDRESS_FLAGS (OUTPUT_SENDER | OUTPUT_RECIPIENTS)\r
+>>> -\r
+>>> typedef enum {\r
+>>> NOTMUCH_FORMAT_JSON,\r
+>>> NOTMUCH_FORMAT_TEXT,\r
+>>> @@ -554,51 +555,55 @@ _notmuch_search_cleanup (search_context_t *ctx)\r
+>>> talloc_free (ctx->format);\r
+>>> }\r
+>>> \r
+>>> +static search_context_t search_context = {\r
+>>> + .format_sel = NOTMUCH_FORMAT_TEXT,\r
+>>> + .exclude = NOTMUCH_EXCLUDE_TRUE,\r
+>>> + .sort = NOTMUCH_SORT_NEWEST_FIRST,\r
+>>> + .output = 0,\r
+>>> + .offset = 0,\r
+>>> + .limit = -1, /* unlimited */\r
+>>> + .dupe = -1,\r
+>>> +};\r
+>>> +\r
+>>> +static const notmuch_opt_desc_t common_options[] = {\r
+>>> + { NOTMUCH_OPT_KEYWORD, &search_context.sort, "sort", 's',\r
+>>> + (notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST },\r
+>>> + { "newest-first", NOTMUCH_SORT_NEWEST_FIRST },\r
+>>> + { 0, 0 } } },\r
+>>> + { NOTMUCH_OPT_KEYWORD, &search_context.format_sel, "format", 'f',\r
+>>> + (notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },\r
+>>> + { "sexp", NOTMUCH_FORMAT_SEXP },\r
+>>> + { "text", NOTMUCH_FORMAT_TEXT },\r
+>>> + { "text0", NOTMUCH_FORMAT_TEXT0 },\r
+>>> + { 0, 0 } } },\r
+>>> + { NOTMUCH_OPT_INT, ¬much_format_version, "format-version", 0, 0 },\r
+>>> + { NOTMUCH_OPT_KEYWORD, &search_context.exclude, "exclude", 'x',\r
+>>> + (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },\r
+>>> + { "false", NOTMUCH_EXCLUDE_FALSE },\r
+>>> + { "flag", NOTMUCH_EXCLUDE_FLAG },\r
+>>> + { "all", NOTMUCH_EXCLUDE_ALL },\r
+>>> + { 0, 0 } } },\r
+>>> + { 0, 0, 0, 0, 0 }\r
+>>> +};\r
+>>> +\r
+>>> int\r
+>>> notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
+>>> {\r
+>>> - search_context_t search_context = {\r
+>>> - .format_sel = NOTMUCH_FORMAT_TEXT,\r
+>>> - .exclude = NOTMUCH_EXCLUDE_TRUE,\r
+>>> - .sort = NOTMUCH_SORT_NEWEST_FIRST,\r
+>>> - .output = 0,\r
+>>> - .offset = 0,\r
+>>> - .limit = -1, /* unlimited */\r
+>>> - .dupe = -1,\r
+>>> - };\r
+>>> search_context_t *ctx = &search_context;\r
+>>> int opt_index, ret;\r
+>>> \r
+>>> notmuch_opt_desc_t options[] = {\r
+>>> - { NOTMUCH_OPT_KEYWORD, &ctx->sort, "sort", 's',\r
+>>> - (notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST },\r
+>>> - { "newest-first", NOTMUCH_SORT_NEWEST_FIRST },\r
+>>> - { 0, 0 } } },\r
+>>> - { NOTMUCH_OPT_KEYWORD, &ctx->format_sel, "format", 'f',\r
+>>> - (notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },\r
+>>> - { "sexp", NOTMUCH_FORMAT_SEXP },\r
+>>> - { "text", NOTMUCH_FORMAT_TEXT },\r
+>>> - { "text0", NOTMUCH_FORMAT_TEXT0 },\r
+>>> - { 0, 0 } } },\r
+>>> - { NOTMUCH_OPT_INT, ¬much_format_version, "format-version", 0, 0 },\r
+>>> { NOTMUCH_OPT_KEYWORD_FLAGS, &ctx->output, "output", 'o',\r
+>>> (notmuch_keyword_t []){ { "summary", OUTPUT_SUMMARY },\r
+>>> { "threads", OUTPUT_THREADS },\r
+>>> { "messages", OUTPUT_MESSAGES },\r
+>>> - { "sender", OUTPUT_SENDER },\r
+>>> - { "recipients", OUTPUT_RECIPIENTS },\r
+>>> { "files", OUTPUT_FILES },\r
+>>> { "tags", OUTPUT_TAGS },\r
+>>> { 0, 0 } } },\r
+>>> - { NOTMUCH_OPT_KEYWORD, &ctx->exclude, "exclude", 'x',\r
+>>> - (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },\r
+>>> - { "false", NOTMUCH_EXCLUDE_FALSE },\r
+>>> - { "flag", NOTMUCH_EXCLUDE_FLAG },\r
+>>> - { "all", NOTMUCH_EXCLUDE_ALL },\r
+>>> - { 0, 0 } } },\r
+>>> { NOTMUCH_OPT_INT, &ctx->offset, "offset", 'O', 0 },\r
+>>> { NOTMUCH_OPT_INT, &ctx->limit, "limit", 'L', 0 },\r
+>>> { NOTMUCH_OPT_INT, &ctx->dupe, "duplicate", 'D', 0 },\r
+>>> + { NOTMUCH_OPT_INHERIT, &common_options, NULL, 0, 0 },\r
+>>> { 0, 0, 0, 0, 0 }\r
+>>> };\r
+>>> \r
+>>> @@ -623,8 +628,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
+>>> ctx->output == OUTPUT_THREADS)\r
+>>> ret = do_search_threads (ctx);\r
+>>> else if (ctx->output == OUTPUT_MESSAGES ||\r
+>>> - ctx->output == OUTPUT_FILES ||\r
+>>> - (ctx->output & OUTPUT_ADDRESS_FLAGS && !(ctx->output & ~OUTPUT_ADDRESS_FLAGS)))\r
+>>> + ctx->output == OUTPUT_FILES)\r
+>>> ret = do_search_messages (ctx);\r
+>>> else if (ctx->output == OUTPUT_TAGS)\r
+>>> ret = do_search_tags (ctx);\r
+>>> @@ -637,3 +641,36 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
+>>> \r
+>>> return ret ? EXIT_FAILURE : EXIT_SUCCESS;\r
+>>> }\r
+>>> +\r
+>>> +int\r
+>>> +notmuch_address_command (notmuch_config_t *config, int argc, char *argv[])\r
+>>> +{\r
+>>> + search_context_t *ctx = &search_context;\r
+>>> + int opt_index, ret;\r
+>>> +\r
+>>> + notmuch_opt_desc_t options[] = {\r
+>>> + { NOTMUCH_OPT_KEYWORD_FLAGS, &ctx->output, "output", 'o',\r
+>>> + (notmuch_keyword_t []){ { "sender", OUTPUT_SENDER },\r
+>>> + { "recipients", OUTPUT_RECIPIENTS },\r
+>>> + { 0, 0 } } },\r
+>>> + { NOTMUCH_OPT_INHERIT, &common_options, NULL, 0, 0 },\r
+>>> + { 0, 0, 0, 0, 0 }\r
+>>> + };\r
+>>> +\r
+>>> + opt_index = parse_arguments (argc, argv, options, 1);\r
+>>> + if (opt_index < 0)\r
+>>> + return EXIT_FAILURE;\r
+>>> +\r
+>>> + if (! ctx->output)\r
+>>> + search_context.output = OUTPUT_SENDER | OUTPUT_RECIPIENTS;\r
+>>> +\r
+>>> + if (_notmuch_search_prepare (ctx, config,\r
+>>> + argc - opt_index, argv + opt_index))\r
+>>> + return EXIT_FAILURE;\r
+>>> +\r
+>>> + ret = do_search_messages (ctx);\r
+>>> +\r
+>>> + _notmuch_search_cleanup (ctx);\r
+>>> +\r
+>>> + return ret ? EXIT_FAILURE : EXIT_SUCCESS;\r
+>>> +}\r
+>>> diff --git a/notmuch.c b/notmuch.c\r
+>>> index dcda039..0fac099 100644\r
+>>> --- a/notmuch.c\r
+>>> +++ b/notmuch.c\r
+>>> @@ -54,6 +54,8 @@ static command_t commands[] = {\r
+>>> "Add a new message into the maildir and notmuch database." },\r
+>>> { "search", notmuch_search_command, FALSE,\r
+>>> "Search for messages matching the given search terms." },\r
+>>> + { "address", notmuch_address_command, FALSE,\r
+>>> + "Get addresses from messages matching the given search terms." },\r
+>>> { "show", notmuch_show_command, FALSE,\r
+>>> "Show all messages matching the search terms." },\r
+>>> { "count", notmuch_count_command, FALSE,\r
+>>> -- \r
+>>> 2.1.1\r
+>>>\r
+>>> _______________________________________________\r
+>>> notmuch mailing list\r
+>>> notmuch@notmuchmail.org\r
+>>> http://notmuchmail.org/mailman/listinfo/notmuch\r