--- /dev/null
+Return-Path: <david@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 93CB26DE0A9A\r
+ for <notmuch@notmuchmail.org>; Fri, 31 Jul 2015 12:12:47 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.151\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.151 tagged_above=-999 required=5 tests=[AWL=0.151]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id k-xM8Gyk46dq for <notmuch@notmuchmail.org>;\r
+ Fri, 31 Jul 2015 12:12:45 -0700 (PDT)\r
+Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 603FE6DE09FB\r
+ for <notmuch@notmuchmail.org>; Fri, 31 Jul 2015 12:12:45 -0700 (PDT)\r
+Received: from remotemail by gitolite.debian.net with local (Exim 4.80)\r
+ (envelope-from <david@tethera.net>)\r
+ id 1ZLFi9-0002MY-Dg; Fri, 31 Jul 2015 19:11:17 +0000\r
+Received: (nullmailer pid 13061 invoked by uid 1000); Fri, 31 Jul 2015\r
+ 19:11:02 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 1/4] cli: show: allow sort order to be specified\r
+In-Reply-To: <1435359035-6767-2-git-send-email-markwalters1009@gmail.com>\r
+References: <1435359035-6767-1-git-send-email-markwalters1009@gmail.com>\r
+ <1435359035-6767-2-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Fri, 31 Jul 2015 21:11:02 +0200\r
+Message-ID: <87d1z8f8hl.fsf@maritornes.cs.unb.ca>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\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: Fri, 31 Jul 2015 19:12:47 -0000\r
+\r
+Mark Walters <markwalters1009@gmail.com> writes:\r
+\r
+> This allows the sort to be specified in the notmuch show command with\r
+> a --sort option.\r
+>\r
+> Note that individual threads are still displayed in oldest first\r
+> order, but if the search has multiple threads then these are ordered\r
+> according to this option. This should mean that most callers won't\r
+> notice the option (e.g. the emacs show mode) as they only call show on\r
+> individual threads, but other users, particularly the emacs tree view,\r
+> can use it.\r
+> ---\r
+> doc/man1/notmuch-show.rst | 17 +++++++++++++++++\r
+> notmuch-show.c | 8 ++++++++\r
+> 2 files changed, 25 insertions(+)\r
+>\r
+> diff --git a/doc/man1/notmuch-show.rst b/doc/man1/notmuch-show.rst\r
+> index 9eb5198..7717b08 100644\r
+> --- a/doc/man1/notmuch-show.rst\r
+> +++ b/doc/man1/notmuch-show.rst\r
+> @@ -97,6 +97,23 @@ Supported options for **show** include\r
+> intended for programs that invoke **notmuch(1)** internally. If\r
+> omitted, the latest supported version will be used.\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
+> + Note: This only affects the order of messages in different\r
+> + threads: messages inside a thread will always be presented in\r
+> + thread order.\r
+\r
+This phrasing is pretty confusing to me. What about saying something\r
+like\r
+\r
+This option can be used to present _threads_ in either ...\r
+\r
+Note: this only affects the ordering of threads: messages inside a\r
+thread will always be presented in thread order.\r
+\r
+> However, the order of the threads will be distinct\r
+> + between these two options (beyond being simply reversed). When\r
+> + sorting by **oldest-first** the threads will be sorted by the\r
+> + oldest message in each thread, but when sorting by\r
+> + **newest-first** the threads will be sorted by the newest\r
+> + message in each thread.\r
+> +\r
+> + By default, results will be displayed in reverse chronological\r
+> + order, (that is, the newest results will be displayed first).\r
+> +\r
+> ``--part=N``\r
+> Output the single decoded MIME part N of a single message. The\r
+> search terms must match only a single message. Message parts are\r
+> diff --git a/notmuch-show.c b/notmuch-show.c\r
+> index b80933a..ec9a915 100644\r
+> --- a/notmuch-show.c\r
+> +++ b/notmuch-show.c\r
+> @@ -1090,6 +1090,7 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])\r
+> int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;\r
+> int exclude = EXCLUDE_TRUE;\r
+> int entire_thread = ENTIRE_THREAD_DEFAULT;\r
+> + notmuch_sort_t sort = NOTMUCH_SORT_NEWEST_FIRST;\r
+> \r
+> notmuch_opt_desc_t options[] = {\r
+> { NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f',\r
+> @@ -1100,10 +1101,15 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])\r
+> { "raw", NOTMUCH_FORMAT_RAW },\r
+> { 0, 0 } } },\r
+> { NOTMUCH_OPT_INT, ¬much_format_version, "format-version", 0, 0 },\r
+> + { NOTMUCH_OPT_KEYWORD, &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, &exclude, "exclude", 'x',\r
+> (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },\r
+> { "false", EXCLUDE_FALSE },\r
+> { 0, 0 } } },\r
+> +\r
+looks like extra whitespace here\r
+> { NOTMUCH_OPT_KEYWORD, &entire_thread, "entire-thread", 't',\r
+> (notmuch_keyword_t []){ { "true", ENTIRE_THREAD_TRUE },\r
+> { "false", ENTIRE_THREAD_FALSE },\r
+> @@ -1233,6 +1239,8 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])\r
+> size_t search_exclude_tags_length;\r
+> unsigned int i;\r
+> \r
+> + notmuch_query_set_sort (query, sort);\r
+> +\r
+\r
+hard to argue with that part ;)\r
+\r