Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / a1 / 4e9b585bf38a60caf0459f663fa164f0b36020
1 Return-Path: <markwalters1009@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 8BEFD421177\r
6         for <notmuch@notmuchmail.org>; Sat, 31 Mar 2012 15:54:16 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id YRnUe2fBiVqp for <notmuch@notmuchmail.org>;\r
18         Sat, 31 Mar 2012 15:54:14 -0700 (PDT)\r
19 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
20         [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id 0ED7F429E5B\r
23         for <notmuch@notmuchmail.org>; Sat, 31 Mar 2012 15:54:12 -0700 (PDT)\r
24 Received: by mail-we0-f181.google.com with SMTP id m13so1257125wer.26\r
25         for <notmuch@notmuchmail.org>; Sat, 31 Mar 2012 15:54:12 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
28         bh=yq8Vk74zuiGLhnHZbw3u4pLV1o6O6YCaUEmj30DXz3o=;\r
29         b=hT0/YtMKS2UDaOuzrxCW/ADf//PtkDQZ4BtyQprz1AYYxGL+Kz8UL1xhXMimzYtTKG\r
30         YUN4fruVSMIItX5okwnHSSW0yQhEuXRsUBdikvC06K09+3IvG0lEXQ/Z3frpcAj6a/nP\r
31         C+ePUTWb/W7FPUVNz6crs84O+BnNrG4NGrUb29bG26A6jsTsqJcCdsVGeoWrZnUtM7Qj\r
32         5EdtCYoiR8JAyGXZ+EUq0PPV7pcGukh6AbTBkljlUDMlMcnbQs5uhT6suMr6T2GZENan\r
33         j1lXfX+/XRXqY03SP//cDJXWYcxfFWc6F7z5x+Y4IQg1Ep5BYb4DRb1Y8tPwDkRx3dz1\r
34         i2TA==\r
35 Received: by 10.180.102.129 with SMTP id fo1mr9901890wib.6.1333234452724;\r
36         Sat, 31 Mar 2012 15:54:12 -0700 (PDT)\r
37 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
38  [94.192.233.223])      by mx.google.com with ESMTPS id\r
39  u9sm20059536wix.0.2012.03.31.15.54.11  (version=TLSv1/SSLv3 cipher=OTHER);\r
40         Sat, 31 Mar 2012 15:54:12 -0700 (PDT)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [PATCH v2 2/6] cli: move count to the new --exclude=(true|false|flag)\r
44         naming scheme.\r
45 Date: Sat, 31 Mar 2012 23:53:58 +0100\r
46 Message-Id: <1333234442-28616-3-git-send-email-markwalters1009@gmail.com>\r
47 X-Mailer: git-send-email 1.7.9.1\r
48 In-Reply-To: <1333234442-28616-1-git-send-email-markwalters1009@gmail.com>\r
49 References: <1333234442-28616-1-git-send-email-markwalters1009@gmail.com>\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Sat, 31 Mar 2012 22:54:17 -0000\r
63 \r
64 Move the option --no-exclude to the --exclude= scheme. Since there is\r
65 no way to flag messages only true and false are implemented. Note\r
66 that, for consistency with other commands, this is implemented as a\r
67 keyword option rather than a boolean option.\r
68 ---\r
69  man/man1/notmuch-count.1 |    5 +++--\r
70  notmuch-count.c          |   17 ++++++++++++-----\r
71  test/count               |    4 ++--\r
72  3 files changed, 17 insertions(+), 9 deletions(-)\r
73 \r
74 diff --git a/man/man1/notmuch-count.1 b/man/man1/notmuch-count.1\r
75 index 35ecc53..d6cbf07 100644\r
76 --- a/man/man1/notmuch-count.1\r
77 +++ b/man/man1/notmuch-count.1\r
78 @@ -41,9 +41,10 @@ Output the number of matching threads.\r
79  \r
80  .RS 4\r
81  .TP 4\r
82 -.BR \-\-no\-exclude\r
83 +.BR \-\-exclude=(true|false)\r
84  \r
85 -Do not exclude the messages matching search.exclude_tags in the config file.\r
86 +Specify whether to omit messages matching search.tag_exclude from the\r
87 +count (the default) or not.\r
88  .RE\r
89  .RE\r
90  .RE\r
91 diff --git a/notmuch-count.c b/notmuch-count.c\r
92 index 46b76ae..b76690c 100644\r
93 --- a/notmuch-count.c\r
94 +++ b/notmuch-count.c\r
95 @@ -26,6 +26,12 @@ enum {\r
96      OUTPUT_MESSAGES,\r
97  };\r
98  \r
99 +/* The following is to allow future options to be added more easily */\r
100 +enum {\r
101 +    EXCLUDE_TRUE,\r
102 +    EXCLUDE_FALSE,\r
103 +};\r
104 +\r
105  int\r
106  notmuch_count_command (void *ctx, int argc, char *argv[])\r
107  {\r
108 @@ -35,7 +41,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
109      char *query_str;\r
110      int opt_index;\r
111      int output = OUTPUT_MESSAGES;\r
112 -    notmuch_bool_t no_exclude = FALSE;\r
113 +    int exclude = EXCLUDE_TRUE;\r
114      unsigned int i;\r
115  \r
116      notmuch_opt_desc_t options[] = {\r
117 @@ -43,7 +49,10 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
118           (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },\r
119                                   { "messages", OUTPUT_MESSAGES },\r
120                                   { 0, 0 } } },\r
121 -       { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },\r
122 +       { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x',\r
123 +         (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },\r
124 +                                 { "false", EXCLUDE_FALSE },\r
125 +                                 { 0, 0 } } },\r
126         { 0, 0, 0, 0, 0 }\r
127      };\r
128  \r
129 @@ -78,7 +87,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
130         return 1;\r
131      }\r
132  \r
133 -    if (!no_exclude) {\r
134 +    if (exclude == EXCLUDE_TRUE) {\r
135         const char **search_exclude_tags;\r
136         size_t search_exclude_tags_length;\r
137  \r
138 @@ -88,8 +97,6 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
139             notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
140      }\r
141  \r
142 -    notmuch_query_set_omit_excluded_messages (query, TRUE);\r
143 -\r
144      switch (output) {\r
145      case OUTPUT_MESSAGES:\r
146         printf ("%u\n", notmuch_query_count_messages (query));\r
147 diff --git a/test/count b/test/count\r
148 index b97fc06..fd387e5 100755\r
149 --- a/test/count\r
150 +++ b/test/count\r
151 @@ -53,9 +53,9 @@ test_expect_equal \\r
152      "1" \\r
153      "`notmuch count subject:deleted and tag:deleted`"\r
154  \r
155 -test_begin_subtest "count \"deleted\" messages, with --no-exclude"\r
156 +test_begin_subtest "count \"deleted\" messages, --exclude=false"\r
157  test_expect_equal \\r
158      "3" \\r
159 -    "`notmuch count --no-exclude subject:deleted`"\r
160 +    "`notmuch count --exclude=false subject:deleted`"\r
161  \r
162  test_done\r
163 -- \r
164 1.7.9.1\r
165 \r