Re: Hi all
[notmuch-archives.git] / be / 5a703a810ccc23921ffecf450f6ee0bf7b2905
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 8FF75429E54\r
6         for <notmuch@notmuchmail.org>; Sat, 25 Feb 2012 19:07:30 -0800 (PST)\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 PSKCk53cUydo for <notmuch@notmuchmail.org>;\r
18         Sat, 25 Feb 2012 19:07:29 -0800 (PST)\r
19 Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com\r
20  [74.125.82.41])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
21  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
22  24D2341806C    for <notmuch@notmuchmail.org>; Sat, 25 Feb 2012 18:50:54 -0800\r
23  (PST)\r
24 Received: by wgbds1 with SMTP id ds1so230173wgb.2\r
25         for <notmuch@notmuchmail.org>; Sat, 25 Feb 2012 18:50:51 -0800 (PST)\r
26 Received-SPF: pass (google.com: domain of markwalters1009@gmail.com designates\r
27         10.180.107.169 as permitted sender) client-ip=10.180.107.169; \r
28 Authentication-Results: mr.google.com; spf=pass (google.com: domain of\r
29         markwalters1009@gmail.com designates 10.180.107.169 as\r
30         permitted sender) smtp.mail=markwalters1009@gmail.com;\r
31         dkim=pass header.i=markwalters1009@gmail.com\r
32 Received: from mr.google.com ([10.180.107.169])\r
33         by 10.180.107.169 with SMTP id hd9mr7283065wib.0.1330224651743\r
34         (num_hops = 1); Sat, 25 Feb 2012 18:50:51 -0800 (PST)\r
35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
36         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
37         bh=SMyRo6NKb+fBzZo1Wm85RVSEOlk9yEp6ESwsayulzUk=;\r
38         b=OC99sSEZXNI0TWCPDbs/diYS3owuWxupKK1OWjdW2lHWlrca348z4pP7NtJqZMsUt3\r
39         24DV0dMbAOd4/OMiGH6dWBkkRePHjcVUkITIuqaDOqqYED9Yu3kuz8P0OAt88e9WleKu\r
40         SyxwfCYcW+DBmDqTqHtBpJAIzm5o1iPB/ap3Y=\r
41 Received: by 10.180.107.169 with SMTP id hd9mr1481257wib.0.1330157151673;\r
42         Sat, 25 Feb 2012 00:05:51 -0800 (PST)\r
43 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
44  [94.192.233.223])      by mx.google.com with ESMTPS id\r
45  h19sm8198804wiw.9.2012.02.25.00.05.50  (version=TLSv1/SSLv3 cipher=OTHER);\r
46         Sat, 25 Feb 2012 00:05:51 -0800 (PST)\r
47 From: Mark Walters <markwalters1009@gmail.com>\r
48 To: notmuch@notmuchmail.org,\r
49         Austin Clements <amdragon@MIT.EDU>\r
50 Subject: [Patch v6 11/13] cli: omit excluded messages in results where\r
51         appropriate.\r
52 Date: Sat, 25 Feb 2012 08:06:42 +0000\r
53 Message-Id: <1330157204-26094-12-git-send-email-markwalters1009@gmail.com>\r
54 X-Mailer: git-send-email 1.7.2.3\r
55 In-Reply-To: <1330157204-26094-1-git-send-email-markwalters1009@gmail.com>\r
56 References: <1330157204-26094-1-git-send-email-markwalters1009@gmail.com>\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61         <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Sun, 26 Feb 2012 03:07:30 -0000\r
70 \r
71 In all cases of notmuch count/search/show where the results returned\r
72 cannot reflect the exclude flag return just the matched not-excluded\r
73 results. If the caller wishes to have all the matched results (i.e.,\r
74 including the excluded ones) they should call with the\r
75 --no-exclude option.\r
76 \r
77 The relevant cases are\r
78     count: both threads and messages\r
79     search: all cases except the summary view\r
80     show: mbox format\r
81 ---\r
82  notmuch-count.c  |    2 ++\r
83  notmuch-search.c |    9 +++++++++\r
84  notmuch-show.c   |    6 ++++++\r
85  3 files changed, 17 insertions(+), 0 deletions(-)\r
86 \r
87 diff --git a/notmuch-count.c b/notmuch-count.c\r
88 index 5364507..46b76ae 100644\r
89 --- a/notmuch-count.c\r
90 +++ b/notmuch-count.c\r
91 @@ -88,6 +88,8 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
92             notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
93      }\r
94  \r
95 +    notmuch_query_set_omit_excluded_messages (query, TRUE);\r
96 +\r
97      switch (output) {\r
98      case OUTPUT_MESSAGES:\r
99         printf ("%u\n", notmuch_query_count_messages (query));\r
100 diff --git a/notmuch-search.c b/notmuch-search.c\r
101 index d1c5553..61c65e5 100644\r
102 --- a/notmuch-search.c\r
103 +++ b/notmuch-search.c\r
104 @@ -207,6 +207,9 @@ do_search_threads (const search_format_t *format,\r
105      int first_thread = 1;\r
106      int i;\r
107  \r
108 +    if (output == OUTPUT_THREADS)\r
109 +       notmuch_query_set_omit_excluded_messages (query, TRUE);\r
110 +\r
111      if (offset < 0) {\r
112         offset += notmuch_query_count_threads (query);\r
113         if (offset < 0)\r
114 @@ -297,6 +300,8 @@ do_search_messages (const search_format_t *format,\r
115      int first_message = 1;\r
116      int i;\r
117  \r
118 +    notmuch_query_set_omit_excluded_messages (query, TRUE);\r
119 +\r
120      if (offset < 0) {\r
121         offset += notmuch_query_count_messages (query);\r
122         if (offset < 0)\r
123 @@ -368,6 +373,10 @@ do_search_tags (notmuch_database_t *notmuch,\r
124      const char *tag;\r
125      int first_tag = 1;\r
126  \r
127 +    notmuch_query_set_omit_excluded_messages (query, TRUE);\r
128 +    /* should the following only special case if no excluded terms\r
129 +     * specified? */\r
130 +\r
131      /* Special-case query of "*" for better performance. */\r
132      if (strcmp (notmuch_query_get_query_string (query), "*") == 0) {\r
133         tags = notmuch_database_get_all_tags (notmuch);\r
134 diff --git a/notmuch-show.c b/notmuch-show.c\r
135 index 2a634e9..17a4ec6 100644\r
136 --- a/notmuch-show.c\r
137 +++ b/notmuch-show.c\r
138 @@ -1080,6 +1080,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
139             fprintf (stderr, "Error: specifying parts is incompatible with mbox output format.\n");\r
140             return 1;\r
141         }\r
142 +\r
143         format = &format_mbox;\r
144         break;\r
145      case NOTMUCH_FORMAT_RAW:\r
146 @@ -1137,6 +1138,11 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
147         return 1;\r
148      }\r
149  \r
150 +    /* if format=mbox then we can not output excluded messages as\r
151 +     * there is no way to make the exclude flag available */\r
152 +    if (format_sel == NOTMUCH_FORMAT_MBOX)\r
153 +       notmuch_query_set_omit_excluded_messages (query, TRUE);\r
154 +\r
155      /* If a single message is requested we do not use search_excludes. */\r
156      if (params.part >= 0)\r
157         ret = do_show_single (ctx, query, format, &params);\r
158 -- \r
159 1.7.2.3\r
160 \r