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