[PATCH] configure: add --without-api-docs option
[notmuch-archives.git] / a4 / a83fa710aa5b3aa7da3619d2315adfeb6d523f
1 Return-Path: <m.walters@qmul.ac.uk>\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 862B6431FAF\r
6         for <notmuch@notmuchmail.org>; Fri,  3 Feb 2012 01:35:29 -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.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id VUOPTJRcMAKD for <notmuch@notmuchmail.org>;\r
17         Fri,  3 Feb 2012 01:35:27 -0800 (PST)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id CE69E431FAE\r
22         for <notmuch@notmuchmail.org>; Fri,  3 Feb 2012 01:35:26 -0800 (PST)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1RtFY9-0002Z8-Ph; Fri, 03 Feb 2012 09:35:22 +0000\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
28         helo=localhost)\r
29         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
30         (envelope-from <m.walters@qmul.ac.uk>)\r
31         id 1RtFY9-0005Z5-AC; Fri, 03 Feb 2012 09:35:21 +0000\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org, amdragon@MIT.EDU\r
34 Subject: Re: [PATCH v4 07/11] lib: added interface\r
35         notmuch_thread_get_flag_messages\r
36 In-Reply-To: <871uqc9uas.fsf@nikula.org>\r
37 References: <874nv9rv79.fsf@qmul.ac.uk>\r
38         <1328204619-25046-7-git-send-email-markwalters1009@gmail.com>\r
39         <87k444yk6i.fsf@nikula.org> <871uqcswfb.fsf@qmul.ac.uk>\r
40         <87d39wygts.fsf@nikula.org> <87sjisrf7b.fsf@qmul.ac.uk>\r
41         <871uqc9uas.fsf@nikula.org>\r
42 User-Agent: Notmuch/0.11+140~gb5e1cf0 (http://notmuchmail.org) Emacs/23.2.1\r
43         (i486-pc-linux-gnu)\r
44 Date: Fri, 03 Feb 2012 09:36:29 +0000\r
45 Message-ID: <87obtgqmw2.fsf@qmul.ac.uk>\r
46 MIME-Version: 1.0\r
47 Content-Type: text/plain; charset=us-ascii\r
48 X-Sender-Host-Address: 94.192.233.223\r
49 X-QM-SPAM-Info: Sender has good ham record.  :)\r
50 X-QM-Body-MD5: 5cb4f1006d45929ce92b11def209f6af (of first 20000 bytes)\r
51 X-SpamAssassin-Score: -1.8\r
52 X-SpamAssassin-SpamBar: -\r
53 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
54         determine if it is\r
55         spam. We require at least 5.0 points to mark a message as spam.\r
56         This message scored -1.8 points.\r
57         Summary of the scoring: \r
58         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
59         *      medium trust\r
60         *      [138.37.6.40 listed in list.dnswl.org]\r
61         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
62         provider *      (markwalters1009[at]gmail.com)\r
63         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
64         *      domain\r
65         *  0.5 AWL AWL: From: address is in the auto white-list\r
66 X-QM-Scan-Virus: ClamAV says the message is clean\r
67 X-BeenThere: notmuch@notmuchmail.org\r
68 X-Mailman-Version: 2.1.13\r
69 Precedence: list\r
70 List-Id: "Use and development of the notmuch mail system."\r
71         <notmuch.notmuchmail.org>\r
72 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
73         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
74 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
75 List-Post: <mailto:notmuch@notmuchmail.org>\r
76 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
77 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
78         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
79 X-List-Received-Date: Fri, 03 Feb 2012 09:35:29 -0000\r
80 \r
81 On Fri, 03 Feb 2012 08:48:27 +0000, Jani Nikula <jani@nikula.org> wrote:\r
82 > On Thu, 02 Feb 2012 23:24:56 +0000, Mark Walters <markwalters1009@gmail.com> wrote:\r
83 > > On Fri, 03 Feb 2012 01:07:59 +0200, Jani Nikula <jani@nikula.org> wrote:\r
84 > > > On Thu, 02 Feb 2012 22:27:36 +0000, Mark Walters <markwalters1009@gmail.com> wrote:\r
85 > > > > On Thu, 02 Feb 2012 23:55:33 +0200, Jani Nikula <jani@nikula.org> wrote:\r
86 > > > > > \r
87 > > > > > Hi Mark -\r
88 > > > > > \r
89 > > > > > This is my first look at any version of the series; apologies if I'm\r
90 > > > > > clueless about some details... Please find some comments below.\r
91 > > > > > \r
92 > > > > > BR,\r
93 > > > > > Jani.\r
94 > > > > > \r
95 > > > > > \r
96 > > > > > On Thu,  2 Feb 2012 17:43:35 +0000, Mark Walters <markwalters1009@gmail.com> wrote:\r
97 > > > > > > The function is\r
98 > > > > > > notmuch_thread_get_flag_messages\r
99 > > > > > > (notmuch_thread_t *thread, unsigned int flag_mask, unsigned int flags)\r
100 > > > > > > \r
101 > > > > > > and returns the number of messages with the specified flags on flag_mask.\r
102 > > > > > \r
103 > > > > > Is the purpose of this function to get the count of messages that have\r
104 > > > > > certain flags set, certain flags not set, and certain flags don't-care?\r
105 > > > > \r
106 > > > > Yes: I was trying to follow Austin's suggestion from\r
107 > > > > id:"20120124025331.GZ16740@mit.edu" (although stupidly I didn't\r
108 > > > > follow his suggestion of a function name).\r
109 > > > > \r
110 > > > > > At the very least, I think the documentation of the function should be\r
111 > > > > > greatly improved.\r
112 > > > > > \r
113 > > > > > I think the name of the function should be notmuch_thread_count_messages\r
114 > > > > > which is like notmuch_query_count_messages, but for messages in threads\r
115 > > > > > (and with some extra restrictions).\r
116 > > > > \r
117 > > > > Yes I like your name; before I change it do you (and others) prefer it\r
118 > > > > to Austin's suggestion of notmuch_thread_count_flags. Or we could even\r
119 > > > > be more verbose with something like\r
120 > > > > notmuch_thread_count_messages_with_flags\r
121 > > > \r
122 > > > I'd like to make it clear that it's about message count. Not about\r
123 > > > getting flags, not about flag counts. _with_flags is a matter of taste,\r
124 > > > no strong opinions there.\r
125 > > \r
126 > > I think I will go with notmuch_thread_count_messages as you suggest.\r
127 > > \r
128 > > > > > >  /* Message flags */\r
129 > > > > > >  typedef enum _notmuch_message_flag {\r
130 > > > > > > -    NOTMUCH_MESSAGE_FLAG_MATCH,\r
131 > > > > > > -    NOTMUCH_MESSAGE_FLAG_EXCLUDED\r
132 > > > > > > +    NOTMUCH_MESSAGE_FLAG_MATCH = (1<<0),\r
133 > > > > > > +    NOTMUCH_MESSAGE_FLAG_EXCLUDED = (1<<1),\r
134 > > > > > > +    NOTMUCH_MESSAGE_FLAG_MAX  = (1<<2)\r
135 > > > > > \r
136 > > > > > How are these used by the current lib users at the moment? How will they\r
137 > > > > > break with this change?\r
138 > > \r
139 > > I will just comment on this: the *only* reason I put in\r
140 > > NOTMUCH_MESSAGE_FLAG_MAX was as a way of keeping track of the size of\r
141 > > the bitfield. If there is a better way do say!\r
142\r
143 > At least one improvement would be to make it NOTMUCH_MESSAGE_FLAG_ALL\r
144 > (or similar) which would be the OR of all the other flags. Above, it\r
145 > should be equal to (1 << 2) - 1. Not only is this something usable to\r
146 > the library users, but also more accurate - if I'm not mistaken, the\r
147 > flagset array currently has one element too many.\r
148\r
149 > If documented properly, the users should not be surprised that in the\r
150 > future more flags might be added to NOTMUCH_MESSAGE_FLAG_ALL, and\r
151 > depending on the case they may or may not want to use that.\r
152 \r
153 I think the current array is the correct size; I do need to keep\r
154 track of the number of messages matching no flags, for example to\r
155 calculate the total number of messages.\r
156 \r
157 I am not sure of the utility of NOTMUCH_MESSAGE_FLAG_ALL as I think ~0\r
158 would give the same result.  I am very happy to add it if others see\r
159 some use, and with your earlier suggestions using ARRAY_SIZE etc I would\r
160 only have one use of NOTMUCH_MESSAGE_FLAG_ALL+1.\r
161 \r
162 > Some purists might say that #defines are better suited for defining bit\r
163 > flags than enums, but I'm fine with either.\r
164 \r
165 I am happy either way.\r
166 \r
167\r
168 > > \r
169 > > > > The only existing flag is NOTMUCH_MESSAGE_FLAG_MATCH: that is currently\r
170 > > > > zero but in the current code that is the bit offset of the flag; in my\r
171 > > > > version it is the actual bit for the flag (otherwise I think flag masks\r
172 > > > > end up very ugly). I believe all callers use notmuch_message_set_flag\r
173 > > > > and notmuch_message_get_flag so they should not notice the difference.\r
174 > > > > \r
175 > > > > > Please align the assignments. \r
176 > > > > \r
177 > > > > Will do.\r
178 > > > > \r
179 > > > > > > @@ -457,8 +452,8 @@ _notmuch_thread_create (void *ctx,\r
180 > > > > > >      thread->message_hash = g_hash_table_new_full (g_str_hash, g_str_equal,\r
181 > > > > > >                                               free, NULL);\r
182 > > > > > >  \r
183 > > > > > > -    thread->total_messages = 0;\r
184 > > > > > > -    thread->matched_messages = 0;\r
185 > > > > > > +    for (i = 0; i < NOTMUCH_MESSAGE_FLAG_MAX; i++)\r
186 > > > > > > +   thread->flag_count_messages[i] = 0;\r
187 > > > > > \r
188 > > > > > memset (thread->flag_count_messages, 0, sizeof(thread->flag_count_messages));\r
189 > > > > \r
190 > > > > \r
191 > > > > Will do \r
192 > > > > \r
193 > > > > > >      thread->oldest = 0;\r
194 > > > > > >      thread->newest = 0;\r
195 > > > > > >  \r
196 > > > > > > @@ -473,6 +468,7 @@ _notmuch_thread_create (void *ctx,\r
197 > > > > > >      notmuch_messages_move_to_next (messages))\r
198 > > > > > >      {\r
199 > > > > > >     unsigned int doc_id;\r
200 > > > > > > +   unsigned int message_flags;\r
201 > > > > > >  \r
202 > > > > > >     message = notmuch_messages_get (messages);\r
203 > > > > > >     doc_id = _notmuch_message_get_doc_id (message);\r
204 > > > > > > @@ -485,6 +481,10 @@ _notmuch_thread_create (void *ctx,\r
205 > > > > > >         _notmuch_doc_id_set_remove (match_set, doc_id);\r
206 > > > > > >         _thread_add_matched_message (thread, message, sort);\r
207 > > > > > >     }\r
208 > > > > > > +   message_flags =\r
209 > > > > > > +       notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) |\r
210 > > > > > > +       notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_EXCLUDED);\r
211 > > > > > > +   thread->flag_count_messages[message_flags]++;\r
212 > > > > > \r
213 > > > > > The first impression of using a set of flags as index is that there's a\r
214 > > > > > bug. But this is to keep count of messages with certain flag sets rather\r
215 > > > > > than total for each flag, right? I think this needs more comments, more\r
216 > > > > > documentation. Already naming the field flag_set_message_counts or\r
217 > > > > > similar would help greatly.\r
218 > > > > \r
219 > > > > I will try and document it better: on first reading I parsed your name\r
220 > > > > as flag set (as verb) message counts whereas I assume you mean "flag\r
221 > > > > set" as a noun! I will see if I can come up with something though.\r
222 > > > \r
223 > > > Yes, as a noun! :)\r
224 > > \r
225 > > I haven't come up with a good name: the best I have come up with is\r
226 > > flagset_message_count so if you have any suggestions...\r
227 > > \r
228 > > > > > >     _notmuch_message_close (message);\r
229 > > > > > >      }\r
230 > > > > > > @@ -511,15 +511,28 @@ notmuch_thread_get_thread_id (notmuch_thread_t *thread)\r
231 > > > > > >  }\r
232 > > > > > >  \r
233 > > > > > >  int\r
234 > > > > > > +notmuch_thread_get_flag_messages (notmuch_thread_t *thread, unsigned int flag_mask, unsigned int flags)\r
235 > > > > > > +{\r
236 > > > > > > +    unsigned int i;\r
237 > > > > > > +    int count = 0;\r
238 > > > > > > +    for (i = 0; i < NOTMUCH_MESSAGE_FLAG_MAX; i++)\r
239 > > > > > \r
240 > > > > > ARRAY_SIZE (thread->flag_count_messages)\r
241 > > > > \r
242 > > > > ok\r
243 > > > > \r
244 > > > > > \r
245 > > > > > > +   if ((i & flag_mask) == (flags & flag_mask))\r
246 > > > > > > +       count += thread->flag_count_messages[i];\r
247 > > > > > > +    return count;\r
248 > > > > > > +}\r
249 > > > > > \r
250 > > > > > I wonder if the same could be accomplished by using two flag mask\r
251 > > > > > parameters, include_flag_mask and exclude_flag_mask. I'm thinking of the\r
252 > > > > > usage, would it be easier to use:\r
253 > > > > > \r
254 > > > > > notmuch_query_count_messages (thread, NOTMUCH_MESSAGE_FLAG_MATCH, NOTMUCH_MESSAGE_FLAG_EXCLUDED);\r
255 > > > > > \r
256 > > > > > to get number of messages that have MATCH but not EXCLUDED? 0 as\r
257 > > > > > include_flag_mask could still be special for "all", and you could use:\r
258 > > > > > \r
259 > > > > > notmuch_query_count_messages (thread, 0, NOTMUCH_MESSAGE_FLAG_EXCLUDED);\r
260 > > > > > \r
261 > > > > > Note the name change according to my earlier suggestion. It might be\r
262 > > > > > wise to not export the function before the API is chrystal clear if\r
263 > > > > > there is no pressing need to do so.\r
264 > > > > \r
265 > > > > (I assume you mean notmuch_thread_count_messages.)\r
266 > > > \r
267 > > > Doh! Yes.\r
268 > > > \r
269 > > > > Can I just check this\r
270 > > > > would return the number of messages which have all the flags  in\r
271 > > > > include_flag_mask and none of the flags in exclude_flag_mask?\r
272 > > \r
273 > > Yes I think this works better: these are the flags I want, these are the\r
274 > > ones I don't want seems natural (versus here are the ones I care about\r
275 > > and here are the ones of those I want). But I will wait to see if anyone\r
276 > > else has an opinion.\r
277 > > \r
278 > > > Yes, but only if it makes sense to you! :)\r
279 > > > \r
280 > > > > \r
281 > > > > I completely agree about leaving it until we have the API well worked\r
282 > > > > out. I wrote it in response to Austin's suggestion and then it looked\r
283 > > > > like it would useful in my attempts to remove the\r
284 > > > > notmuch_query_set_omit_excluded_messages API. However, those attempts\r
285 > > > > failed so it doesn't have any users yet.\r
286 > > > > \r
287 > > > > Best wishes\r
288 > > > > \r
289 > > > > Mark\r