Re: [PATCH] emacs: address completion, allow sender/recipient and filters
[notmuch-archives.git] / 6c / 7030850c0b274e44c8e302a32f943792d10941
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 A49E7431FB6\r
6         for <notmuch@notmuchmail.org>; Thu,  1 Mar 2012 14:29:51 -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 mk42MQoN7HKL for <notmuch@notmuchmail.org>;\r
18         Thu,  1 Mar 2012 14:29:50 -0800 (PST)\r
19 Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com\r
20  [74.125.82.45])        (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  A613D431FDC    for <notmuch@notmuchmail.org>; Thu,  1 Mar 2012 14:29:45 -0800\r
23  (PST)\r
24 Received: by mail-ww0-f45.google.com with SMTP id dt12so108365wgb.2\r
25         for <notmuch@notmuchmail.org>; Thu, 01 Mar 2012 14:29:45 -0800 (PST)\r
26 Received-SPF: pass (google.com: domain of markwalters1009@gmail.com designates\r
27         10.180.107.162 as permitted sender) client-ip=10.180.107.162; \r
28 Authentication-Results: mr.google.com; spf=pass (google.com: domain of\r
29         markwalters1009@gmail.com designates 10.180.107.162 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.162])\r
33         by 10.180.107.162 with SMTP id hd2mr6562681wib.8.1330640985503\r
34         (num_hops = 1); Thu, 01 Mar 2012 14:29:45 -0800 (PST)\r
35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
36         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
37         bh=9k1rZ+UTk4//KtSpKM8nYisUh4WGv1+3Ifs5+7c+azw=;\r
38         b=Ghk33ggocsAGnJieT9zx50ZJGoBwxxMDcXyaHc4IFSrbK9YVuNRSpj+Mh7PQx5H6Mk\r
39         og7UwuOWR6lhCHSGQEC8pw7lkml5cnoMMqdWsS9bebq+IKEXyt8vn99XwWnampD3bHiF\r
40         hZiV3YuCQxPDVrJc6sAegwAtjpvjvXOhSEx2YFzB1SH8j7G9Y5i4PLYLreVl+xmqXIeT\r
41         5ka7Lt/cg5r0PfCtu3E77N/2vlAos9uta+Ev2TIZmuGJLh7zsIfVMdclPm0kvr5RZXt+\r
42         eeVOx/cDNCnrMjMiLyWJDiLcyHAP5k7h4sma1IcQQ8iuq71KqdMmSljc0hXtTUofRdHs\r
43         M/cA==\r
44 Received: by 10.180.107.162 with SMTP id hd2mr5287786wib.8.1330640985449;\r
45         Thu, 01 Mar 2012 14:29:45 -0800 (PST)\r
46 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
47  [94.192.233.223])      by mx.google.com with ESMTPS id\r
48  dr5sm16656885wib.0.2012.03.01.14.29.43 (version=TLSv1/SSLv3 cipher=OTHER);\r
49         Thu, 01 Mar 2012 14:29:44 -0800 (PST)\r
50 From: Mark Walters <markwalters1009@gmail.com>\r
51 To: notmuch@notmuchmail.org\r
52 Subject: [Patch v7 11/13] cli: omit excluded messages in results where\r
53         appropriate.\r
54 Date: Thu,  1 Mar 2012 22:30:43 +0000\r
55 Message-Id: <1330641045-27416-12-git-send-email-markwalters1009@gmail.com>\r
56 X-Mailer: git-send-email 1.7.2.3\r
57 In-Reply-To: <1330641045-27416-1-git-send-email-markwalters1009@gmail.com>\r
58 References: <1330641045-27416-1-git-send-email-markwalters1009@gmail.com>\r
59 X-BeenThere: notmuch@notmuchmail.org\r
60 X-Mailman-Version: 2.1.13\r
61 Precedence: list\r
62 List-Id: "Use and development of the notmuch mail system."\r
63         <notmuch.notmuchmail.org>\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
67 List-Post: <mailto:notmuch@notmuchmail.org>\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
71 X-List-Received-Date: Thu, 01 Mar 2012 22:29:52 -0000\r
72 \r
73 In all cases of notmuch count/search/show where the results returned\r
74 cannot reflect the exclude flag return just the matched not-excluded\r
75 results. If the caller wishes to have all the matched results (i.e.,\r
76 including the excluded ones) they should call with the\r
77 --no-exclude option.\r
78 \r
79 The relevant cases are\r
80     count: both threads and messages\r
81     search: all cases except the summary view\r
82     show: mbox format\r
83 ---\r
84  notmuch-count.c  |    2 ++\r
85  notmuch-search.c |    9 +++++++++\r
86  notmuch-show.c   |    6 ++++++\r
87  3 files changed, 17 insertions(+), 0 deletions(-)\r
88 \r
89 diff --git a/notmuch-count.c b/notmuch-count.c\r
90 index 5364507..46b76ae 100644\r
91 --- a/notmuch-count.c\r
92 +++ b/notmuch-count.c\r
93 @@ -88,6 +88,8 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
94             notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
95      }\r
96  \r
97 +    notmuch_query_set_omit_excluded_messages (query, TRUE);\r
98 +\r
99      switch (output) {\r
100      case OUTPUT_MESSAGES:\r
101         printf ("%u\n", notmuch_query_count_messages (query));\r
102 diff --git a/notmuch-search.c b/notmuch-search.c\r
103 index 6d6c0e6..f6061e4 100644\r
104 --- a/notmuch-search.c\r
105 +++ b/notmuch-search.c\r
106 @@ -210,6 +210,9 @@ do_search_threads (const search_format_t *format,\r
107      int first_thread = 1;\r
108      int i;\r
109  \r
110 +    if (output == OUTPUT_THREADS)\r
111 +       notmuch_query_set_omit_excluded_messages (query, TRUE);\r
112 +\r
113      if (offset < 0) {\r
114         offset += notmuch_query_count_threads (query);\r
115         if (offset < 0)\r
116 @@ -300,6 +303,8 @@ do_search_messages (const search_format_t *format,\r
117      int first_message = 1;\r
118      int i;\r
119  \r
120 +    notmuch_query_set_omit_excluded_messages (query, TRUE);\r
121 +\r
122      if (offset < 0) {\r
123         offset += notmuch_query_count_messages (query);\r
124         if (offset < 0)\r
125 @@ -371,6 +376,10 @@ do_search_tags (notmuch_database_t *notmuch,\r
126      const char *tag;\r
127      int first_tag = 1;\r
128  \r
129 +    notmuch_query_set_omit_excluded_messages (query, TRUE);\r
130 +    /* should the following only special case if no excluded terms\r
131 +     * specified? */\r
132 +\r
133      /* Special-case query of "*" for better performance. */\r
134      if (strcmp (notmuch_query_get_query_string (query), "*") == 0) {\r
135         tags = notmuch_database_get_all_tags (notmuch);\r
136 diff --git a/notmuch-show.c b/notmuch-show.c\r
137 index 8c0b925..05d51b2 100644\r
138 --- a/notmuch-show.c\r
139 +++ b/notmuch-show.c\r
140 @@ -1030,6 +1030,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
141             fprintf (stderr, "Error: specifying parts is incompatible with mbox output format.\n");\r
142             return 1;\r
143         }\r
144 +\r
145         format = &format_mbox;\r
146         break;\r
147      case NOTMUCH_FORMAT_RAW:\r
148 @@ -1087,6 +1088,11 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
149         return 1;\r
150      }\r
151  \r
152 +    /* if format=mbox then we can not output excluded messages as\r
153 +     * there is no way to make the exclude flag available */\r
154 +    if (format_sel == NOTMUCH_FORMAT_MBOX)\r
155 +       notmuch_query_set_omit_excluded_messages (query, TRUE);\r
156 +\r
157      /* If a single message is requested we do not use search_excludes. */\r
158      if (params.part >= 0)\r
159         ret = do_show_single (ctx, query, format, &params);\r
160 -- \r
161 1.7.2.3\r
162 \r