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 28AA4418C25 for ; Thu, 15 Apr 2010 23:38:56 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham 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 OFHdufeZ+JM1 for ; Thu, 15 Apr 2010 23:38:55 -0700 (PDT) Received: from homiemail-a20.g.dreamhost.com (caiajhbdcbhh.dreamhost.com [208.97.132.177]) by olra.theworths.org (Postfix) with ESMTP id 188D4431FC1 for ; Thu, 15 Apr 2010 23:38:55 -0700 (PDT) Received: from localhost.localdomain (unknown [195.190.188.219]) by homiemail-a20.g.dreamhost.com (Postfix) with ESMTPA id E8CCA7EC061; Thu, 15 Apr 2010 23:38:53 -0700 (PDT) From: Sebastian Spaeth To: Notmuch developer list Subject: [PATCH 2/3] notmuch-search: Introduce --sort=unsorted Date: Fri, 16 Apr 2010 08:38:47 +0200 Message-Id: <1271399928-6166-2-git-send-email-Sebastian@SSpaeth.de> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <87eiifj433.fsf@SSpaeth.de> References: <87eiifj433.fsf@SSpaeth.de> 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: Fri, 16 Apr 2010 06:38:56 -0000 In some cases, we might not be interested in any special sort order, so this introduces a --sort=unsorted command line option together with its documentation. Signed-off-by: Sebastian Spaeth --- notmuch-search.c | 2 ++ notmuch.1 | 10 ++++++---- notmuch.c | 7 ++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/notmuch-search.c b/notmuch-search.c index 4e3514b..854a9ae 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -217,6 +217,8 @@ notmuch_search_command (void *ctx, int argc, char *argv[]) sort = NOTMUCH_SORT_OLDEST_FIRST; } else if (strcmp (opt, "newest-first") == 0) { sort = NOTMUCH_SORT_NEWEST_FIRST; + } else if (strcmp (opt, "unsorted") == 0) { + sort = NOTMUCH_SORT_UNSORTED; } else { fprintf (stderr, "Invalid value for --sort: %s\n", opt); return 1; diff --git a/notmuch.1 b/notmuch.1 index 86830f4..6d4beaf 100644 --- a/notmuch.1 +++ b/notmuch.1 @@ -152,12 +152,14 @@ Presents the results in either JSON or plain-text (default). .RE .RS 4 .TP 4 -.BR \-\-sort= ( newest\-first | oldest\-first ) +.BR \-\-sort= ( newest\-first | oldest\-first | unsorted) This option can be used to present results in either chronological order -.RB ( oldest\-first ) -or reverse chronological order -.RB ( newest\-first ). +.RB ( oldest\-first ), +reverse chronological order +.RB ( newest\-first ) +or without any defined sort order +.RB ( unsorted ). Note: The thread order will be distinct between these two options (beyond being simply reversed). When sorting by diff --git a/notmuch.c b/notmuch.c index dcfda32..e31dd88 100644 --- a/notmuch.c +++ b/notmuch.c @@ -165,11 +165,12 @@ command_t commands[] = { "\t\tPresents the results in either JSON or\n" "\t\tplain-text (default)\n" "\n" - "\t--sort=(newest-first|oldest-first)\n" + "\t--sort=(newest-first|oldest-first|unsorted)\n" "\n" "\t\tPresent results in either chronological order\n" - "\t\t(oldest-first) or reverse chronological order\n" - "\t\t(newest-first), which is the default.\n" + "\t\t(oldest-first),reverse chronological order\n" + "\t\t(newest-first), which is the default or\n" + "\t\t(unsorted) without any special sort order.\n" "\n" "\tSee \"notmuch help search-terms\" for details of the search\n" "\tterms syntax." }, -- 1.7.0.4