[PATCH 2/3] notmuch-search: Introduce --sort=unsorted

Sebastian Spaeth Sebastian at SSpaeth.de
Thu Apr 15 23:38:47 PDT 2010


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 <Sebastian at SSpaeth.de>
---
 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



More information about the notmuch mailing list