[RFC PATCH v3 02/11] cli: add sort options to notmuch-show.c
authorMark Walters <markwalters1009@gmail.com>
Mon, 13 Feb 2012 01:20:06 +0000 (01:20 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:25 +0000 (09:44 -0800)
18/8a14b312247856cd0629aae1cb3e29ffdcb8b5 [new file with mode: 0644]

diff --git a/18/8a14b312247856cd0629aae1cb3e29ffdcb8b5 b/18/8a14b312247856cd0629aae1cb3e29ffdcb8b5
new file mode 100644 (file)
index 0000000..ac0cb1c
--- /dev/null
@@ -0,0 +1,100 @@
+Return-Path: <markwalters1009@gmail.com>\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 70625421197\r
+       for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 17:19:20 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] 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 6uPRIUvApt1p for <notmuch@notmuchmail.org>;\r
+       Sun, 12 Feb 2012 17:19:19 -0800 (PST)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+       [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id B52B3421174\r
+       for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 17:19:15 -0800 (PST)\r
+Received: by wibhi8 with SMTP id hi8so3615406wib.26\r
+       for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 17:19:14 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=CVSor5E3TycdRNOUrxPLWmiELuptmyEPmhuSbKtODAQ=;\r
+       b=Bs+OoHDYwbS6GwUM6YROHS6/9Hy+5auV4Kdx53I3PVoJ5QF2RwWLH3Zt3jnA/oSzap\r
+       UWXDKUaotMTJsWNVQPL3znY0l6NDY6T6J0hgyRqtpMTYxDlNal/xlAFsnfnJsw2Up417\r
+       5ZMALaSQm8TuMhSaaX4yni1Q2QbnCKj0KB3Uc=\r
+Received: by 10.180.101.37 with SMTP id fd5mr10698364wib.1.1329095954434;\r
+       Sun, 12 Feb 2012 17:19:14 -0800 (PST)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223])     by mx.google.com with ESMTPS id\r
+ by3sm2815146wib.3.2012.02.12.17.19.13 (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sun, 12 Feb 2012 17:19:13 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC PATCH v3 02/11] cli: add sort options to notmuch-show.c\r
+Date: Mon, 13 Feb 2012 01:20:06 +0000\r
+Message-Id: <1329096015-8078-3-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.2.3\r
+In-Reply-To: <1329072579-27340-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1329072579-27340-1-git-send-email-markwalters1009@gmail.com>\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: Mon, 13 Feb 2012 01:19:20 -0000\r
+\r
+Add the option --sort=newest-first|oldest-first to notmuch-show. This\r
+is used by notmuch-pick.el\r
+---\r
+ notmuch-show.c |    7 +++++++\r
+ 1 files changed, 7 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/notmuch-show.c b/notmuch-show.c\r
+index 9d73685..8f6e520 100644\r
+--- a/notmuch-show.c\r
++++ b/notmuch-show.c\r
+@@ -1030,6 +1030,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+     notmuch_query_t *query;\r
+     char *query_string;\r
+     int opt_index, ret;\r
++    notmuch_sort_t sort = NOTMUCH_SORT_NEWEST_FIRST;\r
+     const notmuch_show_format_t *format = &format_text;\r
+     notmuch_show_params_t params = { .part = -1 };\r
+     int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;\r
+@@ -1043,6 +1044,10 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+                                 { "mbox", NOTMUCH_FORMAT_MBOX },\r
+                                 { "raw", NOTMUCH_FORMAT_RAW },\r
+                                 { 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_INT, &params.part, "part", 'p', 0 },\r
+       { NOTMUCH_OPT_BOOLEAN, &params.entire_thread, "entire-thread", 't', 0 },\r
+       { NOTMUCH_OPT_BOOLEAN, &params.decrypt, "decrypt", 'd', 0 },\r
+@@ -1137,6 +1142,8 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+       return 1;\r
+     }\r
+ \r
++    notmuch_query_set_sort (query, sort);\r
++\r
+     if (params.part >= 0)\r
+       ret = do_show_single (ctx, query, format, &params);\r
+     else\r
+-- \r
+1.7.2.3\r
+\r