[PATCH] Have notmuch count default to showing the total.
authorMike Kelly <pioto@pioto.org>
Thu, 8 Apr 2010 19:39:38 +0000 (15:39 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:32 +0000 (09:36 -0800)
74/763ac9f32549ae66233379cc920771e78e6be2 [new file with mode: 0644]

diff --git a/74/763ac9f32549ae66233379cc920771e78e6be2 b/74/763ac9f32549ae66233379cc920771e78e6be2
new file mode 100644 (file)
index 0000000..89792c3
--- /dev/null
@@ -0,0 +1,88 @@
+Return-Path: <pioto@pioto.org>\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 F01BB4196F0\r
+       for <notmuch@notmuchmail.org>; Thu,  8 Apr 2010 12:39:38 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.5\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.5 tagged_above=-999 required=5\r
+       tests=[BAYES_05=-0.5] 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 pFZue1C2C9A0 for <notmuch@notmuchmail.org>;\r
+       Thu,  8 Apr 2010 12:39:38 -0700 (PDT)\r
+Received: from everglades.pioto.org (everglades.pioto.org [207.192.69.249])\r
+       by olra.theworths.org (Postfix) with ESMTP id 3EC8F431FC1\r
+       for <notmuch@notmuchmail.org>; Thu,  8 Apr 2010 12:39:38 -0700 (PDT)\r
+Received: from aether.pioto.org (pool-96-236-149-110.pitbpa.fios.verizon.net\r
+       [96.236.149.110]) (Authenticated sender: pioto)\r
+       by everglades.pioto.org (Postfix) with ESMTPA id 8211916053F;\r
+       Thu,  8 Apr 2010 15:39:37 -0400 (EDT)\r
+Received: by aether.pioto.org (Postfix, from userid 1000)\r
+       id 9E1AE6B08C; Thu,  8 Apr 2010 15:40:41 -0400 (EDT)\r
+From: Mike Kelly <pioto@pioto.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] Have notmuch count default to showing the total.\r
+Date: Thu,  8 Apr 2010 15:39:38 -0400\r
+Message-Id: <1270755578-23725-1-git-send-email-pioto@pioto.org>\r
+X-Mailer: git-send-email 1.7.0.4\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: Thu, 08 Apr 2010 19:39:39 -0000\r
+\r
+If no parameters are given to notmuch-count, or just '' or '*' are\r
+given, return the total number of messages in the database.\r
+\r
+update notmuch count help\r
+---\r
+ notmuch-count.c |    5 ++---\r
+ notmuch.c       |    4 ++++\r
+ 2 files changed, 6 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/notmuch-count.c b/notmuch-count.c\r
+index 77aa433..97242ab 100644\r
+--- a/notmuch-count.c\r
++++ b/notmuch-count.c\r
+@@ -90,9 +90,8 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
+       fprintf (stderr, "Out of memory.\n");\r
+       return 1;\r
+     }\r
+-    if (*query_str == '\0') {\r
+-      fprintf (stderr, "Error: notmuch count requires at least one count term.\n");\r
+-      return 1;\r
++    if (*query_str == '\0' || (*query_str == '*' && *(query_str+1) == '\0')) {\r
++      query_str = talloc_strdup (ctx, "");\r
+     }\r
\r
+     query = notmuch_query_create (notmuch, query_str);\r
+diff --git a/notmuch.c b/notmuch.c\r
+index f5669fc..8650951 100644\r
+--- a/notmuch.c\r
++++ b/notmuch.c\r
+@@ -220,6 +220,10 @@ command_t commands[] = {\r
+       "\tof messages matching both a specific tag and either inbox\n"\r
+       "\tor unread\n"\r
+       "\n"\r
++      "\tIf no parameters are given, or the special search terms '' or\n"\r
++      "\t'*' are given, it will display the total number of messages in\n"\r
++      "\tthe database.\n"\r
++      "\n"\r
+       "\tSee \"notmuch help search-terms\" for details of the search\n"\r
+       "\t\tterms syntax." },\r
+     { "reply", notmuch_reply_command,\r
+-- \r
+1.7.0.4\r
+\r