Re: Python bindings for adoption
[notmuch-archives.git] / d3 / f968464a6b4771bd6cab6b4736d6056c0e9c92
1 Return-Path: <dmitry.kurochkin@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 290C7429E26\r
6         for <notmuch@notmuchmail.org>; Tue, 13 Dec 2011 19:12:04 -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.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 fCiVnK0tgsrl for <notmuch@notmuchmail.org>;\r
17         Tue, 13 Dec 2011 19:12:03 -0800 (PST)\r
18 Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com\r
19  [74.125.82.45])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
20  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
21  E4841429E25    for <notmuch@notmuchmail.org>; Tue, 13 Dec 2011 19:12:02 -0800\r
22  (PST)\r
23 Received: by wgbds13 with SMTP id ds13so575066wgb.2\r
24         for <notmuch@notmuchmail.org>; Tue, 13 Dec 2011 19:12:00 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:cc:subject:in-reply-to:references:user-agent:date\r
27         :message-id:mime-version:content-type;\r
28         bh=OYTCZESx+piR+sNuqs72az1kebqHwOt3wGD4w9YaEVU=;\r
29         b=J/ZyUhJLZb23aL3O0ie2Wm/jVpcBVLLjIRMlgDXAIXGrBwsWkmkj43bjBarDYFmhY+\r
30         Ugi6F4F53AJh0SoZADLgSmQ3IlD+SPlT62/4a7AHHkfC6rWGqoczkEcbU4vW4ZeqD6gQ\r
31         IX8VASxwKStObv/ndPjkKuOFxHfk5+28B49bI=\r
32 Received: by 10.180.14.69 with SMTP id n5mr1654011wic.13.1323832320258;\r
33         Tue, 13 Dec 2011 19:12:00 -0800 (PST)\r
34 Received: from localhost ([91.144.186.21])\r
35         by mx.google.com with ESMTPS id ej17sm1602459wbb.14.2011.12.13.19.11.57\r
36         (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Tue, 13 Dec 2011 19:11:58 -0800 (PST)\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
39 To: Daniel Schoepe <daniel@schoepe.org>, notmuch@notmuchmail.org\r
40 Subject: Re: [PATCH v6 1/2] emacs: User-defined sections in notmuch-hello\r
41 In-Reply-To: <1318253982-23588-2-git-send-email-daniel@schoepe.org>\r
42 References: <87ippzysmv.fsf@steelpick.2x.cz>\r
43         <1318253982-23588-1-git-send-email-daniel@schoepe.org>\r
44         <1318253982-23588-2-git-send-email-daniel@schoepe.org>\r
45 User-Agent: Notmuch/0.10.2+96~g74e5ae5 (http://notmuchmail.org) Emacs/23.3.1\r
46         (x86_64-pc-linux-gnu)\r
47 Date: Wed, 14 Dec 2011 07:11:21 +0400\r
48 Message-ID: <87aa6vvodi.fsf@gmail.com>\r
49 MIME-Version: 1.0\r
50 Content-Type: text/plain; charset=us-ascii\r
51 Cc: Daniel Schoepe <daniel.schoepe@googlemail.com>\r
52 X-BeenThere: notmuch@notmuchmail.org\r
53 X-Mailman-Version: 2.1.13\r
54 Precedence: list\r
55 List-Id: "Use and development of the notmuch mail system."\r
56         <notmuch.notmuchmail.org>\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
60 List-Post: <mailto:notmuch@notmuchmail.org>\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
64 X-List-Received-Date: Wed, 14 Dec 2011 03:12:04 -0000\r
65 \r
66 Hi Daniel.\r
67 \r
68 I have finished reviewing this patch at last.  Sorry, it is a bit messy.\r
69 Overall, I like the patch.  It is a very nice improvement.\r
70 \r
71 I am sure I have missed some important points, but I guess this is the\r
72 best I can do right now.  Perhaps I will find more comments for the next\r
73 version of the patch :)\r
74 \r
75 As we already discussed on IRC, there are some trailing whitespaces to\r
76 cleanup.\r
77 \r
78 Here is the review:\r
79 \r
80 +(defvar notmuch-custom-section-options\r
81 \r
82 s/notmuch-custom-section-options/notmuch-hello-custom-section-options/ for consistency?\r
83 \r
84 +    (:filter-count (string :tag "Different filter message counts"))\r
85 \r
86 It was not clear to me what this option is for from the docstring.\r
87 Perhaps something like: "Count query filter, if different from :filter"?\r
88 \r
89 +    (:initially-hidden (const :tag "Hide this on startup?" t))\r
90 \r
91 "This" refers to section, right?  If yes, let's state it explicitly:\r
92 "Hide this section on startup".  Also, we should probably remove the\r
93 question mark, or add it to other options for consistency.\r
94 \r
95 Should the default be to show all sections?\r
96 \r
97 +    (:hide-if-empty (const :tag "Hide if empty" t)))\r
98 \r
99 As I understand, this controls whether the whole sections is visible.\r
100 It is not clear what "if empty" means.  Does it mean that all queries\r
101 are empty?  Or all queries are empty and :show-empty-sections is\r
102 false?  Consider changing to something like: "Hide this section if all\r
103 queries are empty [and hidden]".\r
104 \r
105 +  `(list :tag ""\r
106 +        (const :tag "" notmuch-hello-insert-query-list)\r
107 \r
108 Do we need to explicitly specify empty tags?  Aren't they empty by\r
109 default?\r
110 \r
111 +  :tag "Customized tag-list (see docstring for details)"\r
112 +  :tag "Customized queries section (see docstring for details)"\r
113 \r
114 Perhaps it would be more useful to add reference to\r
115 `notmuch-hello-sections'?  I.e. "see `notmuch-hello-sections' for\r
116 details.\r
117 \r
118 Please s/Customized tag-list/Customized tag-list section/ everywhere for\r
119 consistency (or remove section from "Customized queries section").\r
120 \r
121 +Each entry of this list should be a function of no arguments that\r
122 +should return if `notmuch-hello-target' is produced as part of its\r
123 +output and nil otherwise.\r
124 \r
125 Something is missing between "return if".  IMO it is really hard to\r
126 understand what the function should actually do and what it should\r
127 return.  Are this functions expected to add section content to current\r
128 position?  As I understand, the return value indicates whether cursor\r
129 should be positioned somewhere inside this section.  It is a minor\r
130 detail, but it is described in the first (and complex sentence) as if\r
131 it was the most important part.  Consider moving the return and "no\r
132 arguments" to the 3rd paragraph which describes details about the\r
133 functions.  I would also swap 2nd and 3rd paragraph.  Smth like:\r
134 \r
135   The list contains functions which are used to construct sections in\r
136   notmuch-hello buffer.  When notmuch-hello buffer is constructed,\r
137   these functions are run in the order they appear in this list.  Each\r
138   function produces a section simply by adding content to the current\r
139   buffer.  A section should not end with an empty line, because a\r
140   newline will be inserted after each section by `notmuch-hello'.\r
141 \r
142   Each function should take no arguments.  If the produced section\r
143   includes `notmuch-hello-target' (i.e. cursor should be positioned\r
144   inside this section), the function should return [something].\r
145   Otherwise, it should return nil.\r
146 \r
147   For convenience an element can also be a list of the form (FUNC ARG1\r
148   ARG2 .. ARGN) in which case FUNC will be applied to the rest of the\r
149   list.\r
150 \r
151   [ details about customized tag-list and queries sections ]\r
152 \r
153 This is just a draft.  Feel free to use it or ignore it.\r
154 \r
155 + For convenience an element can also be\r
156 \r
157 Remove space the leading space and do `fill-paragraph'.\r
158 \r
159 +           (function :tag "Custom function"))))\r
160 \r
161 Perhaps "Custom section" would be more accurate?\r
162 \r
163 +  "Button at position of point before rebuilding the notmuch-buffer\r
164 \r
165 Missing dot at the end.\r
166 \r
167 s/Button/Button text/?\r
168 \r
169 +This variable contains the string of the button, if any, the\r
170 \r
171 s/the string/text/ or label?\r
172 \r
173 +rebuilt. This is never actually set globally and defined as a\r
174 \r
175 s/is never actually set/should never be set/?\r
176 \r
177 +(defvar notmuch-hello-hidden-sections nil\r
178 +  "List of query section titles whose contents are hidden")\r
179 \r
180 Is this really for query sections only?\r
181 \r
182 Does this duplicate :initially-hidden option from\r
183 notmuch-custom-section-options?\r
184 \r
185 How about adding a global alist variable notmuch-hello-state to store\r
186 the state needed for section functions?  Currently, it would contain\r
187 two values: :first-run and :target.  This would allow us to add more\r
188 state variables in the future without polluting the global namespace.\r
189 Also, it would make clear what variables are section function are\r
190 supposed to use and perhaps even change (docstring should explain that\r
191 of course).\r
192 \r
193 `notmuch-hello-filtered-query':\r
194 \r
195 +      (and result (concat query " and (" result ")"))))\r
196 \r
197 How about using the result as query instead of filter?  I.e. returning\r
198 the result without adding the query to it.  IMO it is simpler and more\r
199 flexible.  In particular, that would allow the function to return nil\r
200 in case the query should not be shown.\r
201 \r
202 Query should be put in ().\r
203 \r
204 +    (concat query " and (" filter ")"))\r
205 \r
206 Same here.\r
207 \r
208 +   (t (concat query))))\r
209 \r
210 Why do we need concat here?\r
211 \r
212 `notmuch-hello-query-counts':\r
213 \r
214 +               (notmuch-hello-filtered-query (cdr query-and-count)\r
215 +                                             (or (plist-get options :filter-count)\r
216 +                                                (plist-get options :filter)))))))\r
217 \r
218 and\r
219 \r
220 +          (list name (notmuch-hello-filtered-query\r
221 +                      (car query-and-count) (plist-get options :filter))\r
222 +                message-count))))\r
223 \r
224 We already handled :filter and :filter-count options in\r
225 `notmuch-hello-generate-tag-alist'.  We should just use the generated\r
226 queries passed in query-alist.\r
227 \r
228 It seems that `notmuch-hello-query-counts' should handle only\r
229 :show-empty-searches option.  If that is true, docstring should be\r
230 updated accordingly.  Also, I think it is better to pass a single\r
231 :show-empty-searches option as a parameter instead of the whole\r
232 options plist.\r
233 \r
234 -         reordered-list)\r
235 +         searches)\r
236 \r
237 I am not sure if this is a mistake.  I hope it is not, because it\r
238 allows us to remove some code :) If this change is correct, please\r
239 make it a separate patch and remove unused reordered-list variable,\r
240 notmuch-hello-reflect and notmuch-hello-reflect-generate-row\r
241 functions.  Otherwise, revert the change.\r
242 \r
243 - "Major mode for convenient notmuch navigation. This is your entry portal into notmuch.\r
244 +  "Major mode for convenient notmuch navigation. This is your entry portal into notmuch.\r
245 \r
246 Please revert.\r
247 \r
248 - (interactive)\r
249 - (kill-all-local-variables)\r
250 - (use-local-map notmuch-hello-mode-map)\r
251 - (setq major-mode 'notmuch-hello-mode\r
252 -       mode-name "notmuch-hello")\r
253 - ;;(setq buffer-read-only t)\r
254 -)\r
255 -\r
256 +  (interactive)\r
257 +  (kill-all-local-variables)\r
258 +  (use-local-map notmuch-hello-mode-map)\r
259 +  (setq major-mode 'notmuch-hello-mode\r
260 +       mode-name "notmuch-hello"))\r
261 +\r
262 \r
263 Please revert.  The commented out line may be removed in a separate patch.\r
264 \r
265 `notmuch-hello-generate-tag-alist':\r
266 \r
267 +                    (list tag (notmuch-hello-filtered-query tag filter-query)\r
268 \r
269 It should be (concat "tag:" tag) instead of tag.  Besides we already\r
270 have it in the query variable, so just use it.\r
271 \r
272 +                  (cons tag (notmuch-hello-filtered-query\r
273 +                             (concat "tag:" tag) filter-query))))))\r
274 \r
275 Same as above: use the query variable.\r
276 \r
277 `notmuch-hello-insert-saved-searches':\r
278 \r
279 Looks like we do not need both `final-target-pos'.  Can we just return\r
280 `found-target-pos'?\r
281 \r
282 `notmuch-hello-insert-search':\r
283 \r
284 +  (insert "\n"))\r
285 \r
286 Should this be `widget-insert'?\r
287 \r
288 Note that there are changes in master that need to be merged into\r
289 `notmuch-hello-insert-search' during rebase.\r
290 \r
291 `notmuch-hello-insert-searches':\r
292 \r
293 if my above comments on `notmuch-hello-query-counts' are correct, the\r
294 docstring should be fixed because `notmuch-hello-insert-searches' does\r
295 not handle :filter and :filter-count options.  Would be nice to move\r
296 this documentation somewhere instead of deleting it.\r
297 \r
298 +         (searches (apply 'notmuch-hello-query-counts query-alist options)))\r
299 \r
300 Why do we need `apply' here?\r
301 \r
302 `notmuch-hello-insert-tags-section':\r
303 \r
304 +  "Insert a section displaying all tags and message counts for each.\r
305 \r
306 Perhaps s/and message counts for each/with message counts/?\r
307 \r
308 `notmuch-hello-insert-inbox':\r
309 \r
310 Perhaps change docstring to something more consistent with other\r
311 notmuch-hello-insert-* functions?  E.g.:\r
312 \r
313   Insert a section displaying saved search and inbox messages for each tag.\r
314 \r
315 +                                 (notmuch-hello-generate-tag-alist))\r
316 +                                :filter "tag:inbox"))\r
317 \r
318 If my above comments are correct, then :filter option should be given\r
319 to `notmuch-hello-generate-tag-alist' instead of\r
320 `notmuch-hello-insert-searches'.\r
321 \r
322 `notmuch-hello-insert-alltags':\r
323 \r
324 Missing dot at the end of docstring.\r
325 \r
326 Perhaps s/and associated message counts/with message counts/?\r
327 \r
328 `notmuch-hello':\r
329 \r
330 -  ; Jump through a hoop to get this value from the deprecated variable\r
331 -  ; name (`notmuch-folders') or from the default value.\r
332 +                                       ; Jump through a hoop to get this value from the deprecated variable\r
333 +                                       ; name (`notmuch-folders') or from the default value.\r
334 \r
335 Please revert.\r
336 \r
337    (if (not notmuch-saved-searches)\r
338 -    (setq notmuch-saved-searches (notmuch-saved-searches)))\r
339 +      (setq notmuch-saved-searches (notmuch-saved-searches)))\r
340 \r
341 Please revert.\r
342 \r
343 +    (setq notmuch-hello-first-run nil)))\r
344 \r
345 Please move this statement to the top level.  There is no need for it\r
346 to be inside let.\r
347 \r
348 \r
349 Regards,\r
350   Dmitry\r