Re: [PATCH] create .mailmap file (for git shortlog/blame)
[notmuch-archives.git] / 56 / 1caf4abac9dbd1c57ebf2beea17a086bfd0713
1 Return-Path: <amdragon@mit.edu>\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 8F25F431E64\r
6         for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 20:51:15 -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: 1.075\r
10 X-Spam-Level: *\r
11 X-Spam-Status: No, score=1.075 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7, URIBL_BLACK=1.775] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id h4AXolSkOs8h for <notmuch@notmuchmail.org>;\r
16         Mon, 30 Jan 2012 20:51:14 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU\r
18         [18.7.68.36])\r
19         by olra.theworths.org (Postfix) with ESMTP id B193F431FBC\r
20         for <notmuch@notmuchmail.org>; Mon, 30 Jan 2012 20:51:14 -0800 (PST)\r
21 X-AuditID: 12074424-b7fae6d000000906-c6-4f2773429b1e\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id C3.1A.02310.243772F4; Mon, 30 Jan 2012 23:51:14 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q0V4pDC8016020; \r
27         Mon, 30 Jan 2012 23:51:14 -0500\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0V4pCv8001110\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Mon, 30 Jan 2012 23:51:13 -0500 (EST)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1Rs5fg-0002mn-Rg; Mon, 30 Jan 2012 23:50:20 -0500\r
37 Date: Mon, 30 Jan 2012 23:50:20 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Mark Walters <markwalters1009@gmail.com>\r
40 Subject: Re: [PATCH 4/7] lib: Add the exclude flag to\r
41         notmuch_query_search_threads\r
42 Message-ID: <20120131045020.GA17991@mit.edu>\r
43 References: <8762fu4aqt.fsf@qmul.ac.uk>\r
44         <1327862394-14334-4-git-send-email-markwalters1009@gmail.com>\r
45 MIME-Version: 1.0\r
46 Content-Type: text/plain; charset=us-ascii\r
47 Content-Disposition: inline\r
48 In-Reply-To: <1327862394-14334-4-git-send-email-markwalters1009@gmail.com>\r
49 User-Agent: Mutt/1.5.21 (2010-09-15)\r
50 X-Brightmail-Tracker:\r
51  H4sIAAAAAAAAA+NgFupnleLIzCtJLcpLzFFi42IRYrdT0XUqVvc3aHgiYLF6Lo/F9ZszmR2Y\r
52         PHbOusvu8WzVLeYApigum5TUnMyy1CJ9uwSujPkXNjAXbFeq+P70IlsD40TpLkZODgkBE4lN\r
53         V1ewQ9hiEhfurWfrYuTiEBLYxyhx8uIKKGcDo8SdPydYIJyTTBLHVvWwQzhLGCU6WvexgPSz\r
54         CKhKdJ08wwpiswloSGzbv5wRxBYR0JG4fWgB2A5mAWmJb7+bmUBsYYEQiccf94HV8wLVXNjU\r
55         BRYXEkiX2Pz8LQtEXFDi5MwnLBC9WhI3/r0EquEAm7P8HwdImFPAS2LD9V6w8aICKhJTTm5j\r
56         m8AoNAtJ9ywk3bMQuhcwMq9ilE3JrdLNTczMKU5N1i1OTszLSy3SNdfLzSzRS00p3cQIDmsX\r
57         lR2MzYeUDjEKcDAq8fAKfVLzF2JNLCuuzD3EKMnBpCTKO6dA3V+ILyk/pTIjsTgjvqg0J7X4\r
58         EKMEB7OSCO+b1UDlvCmJlVWpRfkwKWkOFiVxXg2td35A/yaWpGanphakFsFkZTg4lCR424qA\r
59         hgoWpaanVqRl5pQgpJk4OEGG8wAN3wtSw1tckJhbnJkOkT/FqMvR/nb3eUYhlrz8vFQpcd6F\r
60         IEUCIEUZpXlwc2Dp6BWjONBbwrxLQKp4gKkMbtIroCVMQEueM6iCLClJREhJNTCu3hv/LexN\r
61         wk23CcEnP+8Uv8aRYNizfF5085+pkTMq7G9cUZs+/2TApKUvbmRu+OL9rYDrxaVr7ZfYQrRf\r
62         /Is98yRop2HCBL4Wh6fK5onmV1xubrsetkfxScPnQL8MtpquREatdTwbjb+m5z/6/8dy0evD\r
63         KuyeC8WWf1th+HRnY8kXtcKnAhOslViKMxINtZiLihMBGXa/PiIDAAA=\r
64 Cc: notmuch@notmuchmail.org\r
65 X-BeenThere: notmuch@notmuchmail.org\r
66 X-Mailman-Version: 2.1.13\r
67 Precedence: list\r
68 List-Id: "Use and development of the notmuch mail system."\r
69         <notmuch.notmuchmail.org>\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
73 List-Post: <mailto:notmuch@notmuchmail.org>\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
76         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
77 X-List-Received-Date: Tue, 31 Jan 2012 04:51:15 -0000\r
78 \r
79 Quoth Mark Walters on Jan 29 at  6:39 pm:\r
80 > Add the NOTMUCH_MESSAGE_FLAG_EXCLUDED flag to\r
81 > notmuch_query_search_threads. Implemented by inspecting the tags\r
82 > directly in _notmuch_thread_create/_thread_add_message rather than as\r
83 > a Xapian query for speed reasons.\r
84 > ---\r
85 >  lib/notmuch-private.h |   16 ++++++++++------\r
86 >  lib/query.cc          |    1 +\r
87 >  lib/thread.cc         |   18 +++++++++++++++---\r
88 >  3 files changed, 26 insertions(+), 9 deletions(-)\r
89\r
90 > diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h\r
91 > index e791bb0..56b87c6 100644\r
92 > --- a/lib/notmuch-private.h\r
93 > +++ b/lib/notmuch-private.h\r
94 > @@ -211,12 +211,8 @@ _notmuch_directory_get_document_id (notmuch_directory_t *directory);\r
95 >  \r
96 >  /* thread.cc */\r
97 >  \r
98 > -notmuch_thread_t *\r
99 > -_notmuch_thread_create (void *ctx,\r
100 > -                     notmuch_database_t *notmuch,\r
101 > -                     unsigned int seed_doc_id,\r
102 > -                     notmuch_doc_id_set_t *match_set,\r
103 > -                     notmuch_sort_t sort);\r
104 > +/* Definition of _notmuch_thread_create moved later since now uses\r
105 > + * string_list_t */\r
106 \r
107 Naw, leave the definition here along with the other things from\r
108 thread.cc and just add a\r
109 \r
110   typedef struct _notmuch_string_list notmuch_string_list_t;\r
111 \r
112 along with the typedef for notmuch_doc_id_set_t near the top.  (You\r
113 might also have to tweak the typedef of notmuch_string_list_t later so\r
114 it's just the struct definition.)\r
115 \r
116 >  \r
117 >  /* message.cc */\r
118 >  \r
119 > @@ -492,6 +488,14 @@ notmuch_filenames_t *\r
120 >  _notmuch_filenames_create (const void *ctx,\r
121 >                          notmuch_string_list_t *list);\r
122 >  \r
123 > +notmuch_thread_t *\r
124 > +_notmuch_thread_create (void *ctx,\r
125 > +                     notmuch_database_t *notmuch,\r
126 > +                     unsigned int seed_doc_id,\r
127 > +                     notmuch_doc_id_set_t *match_set,\r
128 > +                     notmuch_string_list_t *excluded_terms,\r
129 > +                     notmuch_sort_t sort);\r
130 > +\r
131 >  #pragma GCC visibility pop\r
132 >  \r
133 >  NOTMUCH_END_DECLS\r
134 > diff --git a/lib/query.cc b/lib/query.cc\r
135 > index 7d165d2..dee7ec0 100644\r
136 > --- a/lib/query.cc\r
137 > +++ b/lib/query.cc\r
138 > @@ -472,6 +472,7 @@ notmuch_threads_get (notmuch_threads_t *threads)\r
139 >                                  threads->query->notmuch,\r
140 >                                  doc_id,\r
141 >                                  &threads->match_set,\r
142 > +                                threads->query->exclude_terms,\r
143 >                                  threads->query->sort);\r
144 >  }\r
145 >  \r
146 > diff --git a/lib/thread.cc b/lib/thread.cc\r
147 > index 0435ee6..6d65d52 100644\r
148 > --- a/lib/thread.cc\r
149 > +++ b/lib/thread.cc\r
150 > @@ -214,7 +214,8 @@ _thread_cleanup_author (notmuch_thread_t *thread,\r
151 >   */\r
152 >  static void\r
153 >  _thread_add_message (notmuch_thread_t *thread,\r
154 > -                  notmuch_message_t *message)\r
155 > +                  notmuch_message_t *message,\r
156 > +                  notmuch_string_list_t *exclude_terms)\r
157 >  {\r
158 >      notmuch_tags_t *tags;\r
159 >      const char *tag;\r
160 > @@ -262,6 +263,15 @@ _thread_add_message (notmuch_thread_t *thread,\r
161 >        notmuch_tags_move_to_next (tags))\r
162 >      {\r
163 >       tag = notmuch_tags_get (tags);\r
164 > +     /* mark excluded messages */\r
165 \r
166 Capital and period.\r
167 \r
168 > +     for (notmuch_string_node_t *term = exclude_terms->head; term;\r
169 > +          term = term->next) {\r
170 > +         /* we ignore initial 'K' */\r
171 \r
172 Same.\r
173 \r
174 > +         if (strcmp(tag, (term->string + 1)) == 0) {\r
175 > +             notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED, TRUE);\r
176 > +             break;\r
177 > +         }\r
178 > +     }\r
179 >       g_hash_table_insert (thread->tags, xstrdup (tag), NULL);\r
180 >      }\r
181 >  }\r
182 > @@ -321,7 +331,8 @@ _thread_add_matched_message (notmuch_thread_t *thread,\r
183 >           _thread_set_subject_from_message (thread, message);\r
184 >      }\r
185 >  \r
186 > -    thread->matched_messages++;\r
187 > +    if (!notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED))\r
188 > +     thread->matched_messages++;\r
189 \r
190 I'd still say this warrants a better API.\r
191 \r
192 >  \r
193 >      if (g_hash_table_lookup_extended (thread->message_hash,\r
194 >                           notmuch_message_get_message_id (message), NULL,\r
195 > @@ -392,6 +403,7 @@ _notmuch_thread_create (void *ctx,\r
196 >                       notmuch_database_t *notmuch,\r
197 >                       unsigned int seed_doc_id,\r
198 >                       notmuch_doc_id_set_t *match_set,\r
199 > +                     notmuch_string_list_t *exclude_terms,\r
200 >                       notmuch_sort_t sort)\r
201 >  {\r
202 >      notmuch_thread_t *thread;\r
203 > @@ -467,7 +479,7 @@ _notmuch_thread_create (void *ctx,\r
204 >       if (doc_id == seed_doc_id)\r
205 >           message = seed_message;\r
206 >  \r
207 > -     _thread_add_message (thread, message);\r
208 > +     _thread_add_message (thread, message, exclude_terms);\r
209 >  \r
210 >       if ( _notmuch_doc_id_set_contains (match_set, doc_id)) {\r
211 >           _notmuch_doc_id_set_remove (match_set, doc_id);\r