--- /dev/null
+Return-Path: <Sebastian@SSpaeth.de>\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 D36EF418C25\r
+ for <notmuch@notmuchmail.org>; Thu, 15 Apr 2010 23:38:54 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.9\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
+ tests=[BAYES_00=-1.9] autolearn=ham\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 5iKU0DIEB-Ag for <notmuch@notmuchmail.org>;\r
+ Thu, 15 Apr 2010 23:38:54 -0700 (PDT)\r
+Received: from homiemail-a20.g.dreamhost.com (caiajhbdcaib.dreamhost.com\r
+ [208.97.132.81])\r
+ by olra.theworths.org (Postfix) with ESMTP id F38EC431FC1\r
+ for <notmuch@notmuchmail.org>; Thu, 15 Apr 2010 23:38:53 -0700 (PDT)\r
+Received: from localhost.localdomain (unknown [195.190.188.219])\r
+ by homiemail-a20.g.dreamhost.com (Postfix) with ESMTPA id BBF3E7EC060; \r
+ Thu, 15 Apr 2010 23:38:52 -0700 (PDT)\r
+From: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
+To: Notmuch developer list <notmuch@notmuchmail.org>\r
+Subject: [PATCH 1/3] query.cc: allow to return query results unsorted\r
+Date: Fri, 16 Apr 2010 08:38:46 +0200\r
+Message-Id: <1271399928-6166-1-git-send-email-Sebastian@SSpaeth.de>\r
+X-Mailer: git-send-email 1.7.0.4\r
+In-Reply-To: <87eiifj433.fsf@SSpaeth.de>\r
+References: <87eiifj433.fsf@SSpaeth.de>\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: Fri, 16 Apr 2010 06:38:55 -0000\r
+\r
+Previously, we always sorted the returned results by some string value,\r
+(newest-to-oldest by default), however in some cases (as when applying\r
+tags to a search result) we are not interested in any special order.\r
+\r
+This introduces a NOTMUCH_SORT_UNSORTED value that does just that. It is\r
+not used at the moment anywhere in the code.\r
+\r
+Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
+---\r
+ lib/notmuch.h | 3 ++-\r
+ lib/query.cc | 2 ++\r
+ 2 files changed, 4 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/lib/notmuch.h b/lib/notmuch.h\r
+index a7e66dd..bae48a6 100644\r
+--- a/lib/notmuch.h\r
++++ b/lib/notmuch.h\r
+@@ -346,7 +346,8 @@ notmuch_query_create (notmuch_database_t *database,\r
+ typedef enum {\r
+ NOTMUCH_SORT_OLDEST_FIRST,\r
+ NOTMUCH_SORT_NEWEST_FIRST,\r
+- NOTMUCH_SORT_MESSAGE_ID\r
++ NOTMUCH_SORT_MESSAGE_ID,\r
++ NOTMUCH_SORT_UNSORTED\r
+ } notmuch_sort_t;\r
+ \r
+ /* Specify the sorting desired for this query. */\r
+diff --git a/lib/query.cc b/lib/query.cc\r
+index 10f8dc8..4148f9b 100644\r
+--- a/lib/query.cc\r
++++ b/lib/query.cc\r
+@@ -148,6 +148,8 @@ notmuch_query_search_messages (notmuch_query_t *query)\r
+ case NOTMUCH_SORT_MESSAGE_ID:\r
+ enquire.set_sort_by_value (NOTMUCH_VALUE_MESSAGE_ID, FALSE);\r
+ break;\r
++ case NOTMUCH_SORT_UNSORTED:\r
++ break;\r
+ }\r
+ \r
+ #if DEBUG_QUERY\r
+-- \r
+1.7.0.4\r
+\r