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 AACCD429E2F
\r
6 for <notmuch@notmuchmail.org>; Wed, 14 Dec 2011 04:56:20 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 67hslP3k5qI9 for <notmuch@notmuchmail.org>;
\r
17 Wed, 14 Dec 2011 04:56:19 -0800 (PST)
\r
18 Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com
\r
19 [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 2E08C429E27
\r
22 for <notmuch@notmuchmail.org>; Wed, 14 Dec 2011 04:56:19 -0800 (PST)
\r
23 Received: by faaa5 with SMTP id a5so1226475faa.26
\r
24 for <notmuch@notmuchmail.org>; Wed, 14 Dec 2011 04:56:16 -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=FCpf1oJfGQsnOpqAwkrEXhnTrunbAoherA5cm+dOQGE=;
\r
29 b=lAu36UbYuLTGVeelLfMn6Sk9NoUnwG2GUoT9UM1sS6bITMm0PapFnJtmXYRCN5svuL
\r
30 GtSLZzs2QUlAxU1JEqITts40a917VkE+ZGtXArdqR67gnC4DptncgNWZbVZekFwwZrSC
\r
31 gYcYzIGRiGFeQ/ygK0864ONBfWHz/HMOtYuPM=
\r
32 Received: by 10.180.18.233 with SMTP id z9mr4531871wid.0.1323867376461;
\r
33 Wed, 14 Dec 2011 04:56:16 -0800 (PST)
\r
34 Received: from localhost ([91.144.186.21])
\r
35 by mx.google.com with ESMTPS id m5sm3329463wie.2.2011.12.14.04.56.13
\r
36 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Wed, 14 Dec 2011 04:56:14 -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: <87aa6vvodi.fsf@gmail.com>
\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 <87aa6vvodi.fsf@gmail.com>
\r
46 User-Agent: Notmuch/0.10.2+96~g74e5ae5 (http://notmuchmail.org) Emacs/23.3.1
\r
47 (x86_64-pc-linux-gnu)
\r
48 Date: Wed, 14 Dec 2011 16:55:36 +0400
\r
49 Message-ID: <877h1zuxbr.fsf@gmail.com>
\r
51 Content-Type: text/plain; charset=us-ascii
\r
52 Cc: Daniel Schoepe <daniel.schoepe@googlemail.com>
\r
53 X-BeenThere: notmuch@notmuchmail.org
\r
54 X-Mailman-Version: 2.1.13
\r
56 List-Id: "Use and development of the notmuch mail system."
\r
57 <notmuch.notmuchmail.org>
\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
61 List-Post: <mailto:notmuch@notmuchmail.org>
\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
64 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
65 X-List-Received-Date: Wed, 14 Dec 2011 12:56:20 -0000
\r
67 On Wed, 14 Dec 2011 07:11:21 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
\r
70 > I have finished reviewing this patch at last. Sorry, it is a bit messy.
\r
71 > Overall, I like the patch. It is a very nice improvement.
\r
73 > I am sure I have missed some important points, but I guess this is the
\r
74 > best I can do right now. Perhaps I will find more comments for the next
\r
75 > version of the patch :)
\r
77 > As we already discussed on IRC, there are some trailing whitespaces to
\r
80 > Here is the review:
\r
82 > +(defvar notmuch-custom-section-options
\r
84 > s/notmuch-custom-section-options/notmuch-hello-custom-section-options/ for consistency?
\r
86 > + (:filter-count (string :tag "Different filter message counts"))
\r
88 > It was not clear to me what this option is for from the docstring.
\r
89 > Perhaps something like: "Count query filter, if different from :filter"?
\r
91 > + (:initially-hidden (const :tag "Hide this on startup?" t))
\r
93 > "This" refers to section, right? If yes, let's state it explicitly:
\r
94 > "Hide this section on startup". Also, we should probably remove the
\r
95 > question mark, or add it to other options for consistency.
\r
97 > Should the default be to show all sections?
\r
99 > + (:hide-if-empty (const :tag "Hide if empty" t)))
\r
101 > As I understand, this controls whether the whole sections is visible.
\r
102 > It is not clear what "if empty" means. Does it mean that all queries
\r
103 > are empty? Or all queries are empty and :show-empty-sections is
\r
104 > false? Consider changing to something like: "Hide this section if all
\r
105 > queries are empty [and hidden]".
\r
108 > + (const :tag "" notmuch-hello-insert-query-list)
\r
110 > Do we need to explicitly specify empty tags? Aren't they empty by
\r
113 > + :tag "Customized tag-list (see docstring for details)"
\r
114 > + :tag "Customized queries section (see docstring for details)"
\r
116 > Perhaps it would be more useful to add reference to
\r
117 > `notmuch-hello-sections'? I.e. "see `notmuch-hello-sections' for
\r
120 > Please s/Customized tag-list/Customized tag-list section/ everywhere for
\r
121 > consistency (or remove section from "Customized queries section").
\r
123 > +Each entry of this list should be a function of no arguments that
\r
124 > +should return if `notmuch-hello-target' is produced as part of its
\r
125 > +output and nil otherwise.
\r
127 > Something is missing between "return if". IMO it is really hard to
\r
128 > understand what the function should actually do and what it should
\r
129 > return. Are this functions expected to add section content to current
\r
130 > position? As I understand, the return value indicates whether cursor
\r
131 > should be positioned somewhere inside this section. It is a minor
\r
132 > detail, but it is described in the first (and complex sentence) as if
\r
133 > it was the most important part. Consider moving the return and "no
\r
134 > arguments" to the 3rd paragraph which describes details about the
\r
135 > functions. I would also swap 2nd and 3rd paragraph. Smth like:
\r
137 > The list contains functions which are used to construct sections in
\r
138 > notmuch-hello buffer. When notmuch-hello buffer is constructed,
\r
139 > these functions are run in the order they appear in this list. Each
\r
140 > function produces a section simply by adding content to the current
\r
141 > buffer. A section should not end with an empty line, because a
\r
142 > newline will be inserted after each section by `notmuch-hello'.
\r
144 > Each function should take no arguments. If the produced section
\r
145 > includes `notmuch-hello-target' (i.e. cursor should be positioned
\r
146 > inside this section), the function should return [something].
\r
147 > Otherwise, it should return nil.
\r
149 > For convenience an element can also be a list of the form (FUNC ARG1
\r
150 > ARG2 .. ARGN) in which case FUNC will be applied to the rest of the
\r
153 > [ details about customized tag-list and queries sections ]
\r
155 > This is just a draft. Feel free to use it or ignore it.
\r
157 > + For convenience an element can also be
\r
159 > Remove space the leading space and do `fill-paragraph'.
\r
161 > + (function :tag "Custom function"))))
\r
163 > Perhaps "Custom section" would be more accurate?
\r
165 > + "Button at position of point before rebuilding the notmuch-buffer
\r
167 > Missing dot at the end.
\r
169 > s/Button/Button text/?
\r
171 > +This variable contains the string of the button, if any, the
\r
173 > s/the string/text/ or label?
\r
175 > +rebuilt. This is never actually set globally and defined as a
\r
177 > s/is never actually set/should never be set/?
\r
179 > +(defvar notmuch-hello-hidden-sections nil
\r
180 > + "List of query section titles whose contents are hidden")
\r
182 > Is this really for query sections only?
\r
184 > Does this duplicate :initially-hidden option from
\r
185 > notmuch-custom-section-options?
\r
187 > How about adding a global alist variable notmuch-hello-state to store
\r
188 > the state needed for section functions? Currently, it would contain
\r
189 > two values: :first-run and :target. This would allow us to add more
\r
190 > state variables in the future without polluting the global namespace.
\r
191 > Also, it would make clear what variables are section function are
\r
192 > supposed to use and perhaps even change (docstring should explain that
\r
195 > `notmuch-hello-filtered-query':
\r
197 > + (and result (concat query " and (" result ")"))))
\r
199 > How about using the result as query instead of filter? I.e. returning
\r
200 > the result without adding the query to it. IMO it is simpler and more
\r
201 > flexible. In particular, that would allow the function to return nil
\r
202 > in case the query should not be shown.
\r
204 > Query should be put in ().
\r
206 > + (concat query " and (" filter ")"))
\r
210 > + (t (concat query))))
\r
212 > Why do we need concat here?
\r
214 > `notmuch-hello-query-counts':
\r
216 > + (notmuch-hello-filtered-query (cdr query-and-count)
\r
217 > + (or (plist-get options :filter-count)
\r
218 > + (plist-get options :filter)))))))
\r
222 > + (list name (notmuch-hello-filtered-query
\r
223 > + (car query-and-count) (plist-get options :filter))
\r
224 > + message-count))))
\r
226 > We already handled :filter and :filter-count options in
\r
227 > `notmuch-hello-generate-tag-alist'. We should just use the generated
\r
228 > queries passed in query-alist.
\r
230 > It seems that `notmuch-hello-query-counts' should handle only
\r
231 > :show-empty-searches option. If that is true, docstring should be
\r
232 > updated accordingly. Also, I think it is better to pass a single
\r
233 > :show-empty-searches option as a parameter instead of the whole
\r
237 After thinking more about it, handling :filter and :filter-count in
\r
238 `notmuch-hello-query-counts' is useful. I may want to set "not
\r
239 tag:spam" filter for all saved searches (if we add this customize option
\r
240 later). So `notmuch-hello-query-counts' should handle :filter and
\r
241 :filter-count options, while `notmuch-hello-generate-tag-alist' should
\r
242 just handle :hide-tags and return ("name" . "tag:name") list.
\r
244 Actually, we should rename :hide-tags to more general :hide-queries or
\r
245 :hide-search and handle it in `notmuch-hello-query-counts' as well.
\r
246 `notmuch-hello-generate-tag-alist' would become very simple: it would
\r
247 just get all tags from notmuch and make list of ("name" . "tag:name")
\r
248 for each. All query-related options would be handled on a single place.
\r
249 Currently, :hide-tags is used only for tags, it makes little sense to
\r
250 hide saved searches. But one may want to add a section which gets list
\r
251 of queries from some external source (similar to notmuch search-tags)
\r
252 and hiding some queries would make sense.
\r
257 > - reordered-list)
\r
260 > I am not sure if this is a mistake. I hope it is not, because it
\r
261 > allows us to remove some code :) If this change is correct, please
\r
262 > make it a separate patch and remove unused reordered-list variable,
\r
263 > notmuch-hello-reflect and notmuch-hello-reflect-generate-row
\r
264 > functions. Otherwise, revert the change.
\r
266 > - "Major mode for convenient notmuch navigation. This is your entry portal into notmuch.
\r
267 > + "Major mode for convenient notmuch navigation. This is your entry portal into notmuch.
\r
272 > - (kill-all-local-variables)
\r
273 > - (use-local-map notmuch-hello-mode-map)
\r
274 > - (setq major-mode 'notmuch-hello-mode
\r
275 > - mode-name "notmuch-hello")
\r
276 > - ;;(setq buffer-read-only t)
\r
280 > + (kill-all-local-variables)
\r
281 > + (use-local-map notmuch-hello-mode-map)
\r
282 > + (setq major-mode 'notmuch-hello-mode
\r
283 > + mode-name "notmuch-hello"))
\r
286 > Please revert. The commented out line may be removed in a separate patch.
\r
288 > `notmuch-hello-generate-tag-alist':
\r
290 > + (list tag (notmuch-hello-filtered-query tag filter-query)
\r
292 > It should be (concat "tag:" tag) instead of tag. Besides we already
\r
293 > have it in the query variable, so just use it.
\r
295 > + (cons tag (notmuch-hello-filtered-query
\r
296 > + (concat "tag:" tag) filter-query))))))
\r
298 > Same as above: use the query variable.
\r
300 > `notmuch-hello-insert-saved-searches':
\r
302 > Looks like we do not need both `final-target-pos'. Can we just return
\r
303 > `found-target-pos'?
\r
305 > `notmuch-hello-insert-search':
\r
309 > Should this be `widget-insert'?
\r
311 > Note that there are changes in master that need to be merged into
\r
312 > `notmuch-hello-insert-search' during rebase.
\r
314 > `notmuch-hello-insert-searches':
\r
316 > if my above comments on `notmuch-hello-query-counts' are correct, the
\r
317 > docstring should be fixed because `notmuch-hello-insert-searches' does
\r
318 > not handle :filter and :filter-count options. Would be nice to move
\r
319 > this documentation somewhere instead of deleting it.
\r
321 > + (searches (apply 'notmuch-hello-query-counts query-alist options)))
\r
323 > Why do we need `apply' here?
\r
325 > `notmuch-hello-insert-tags-section':
\r
327 > + "Insert a section displaying all tags and message counts for each.
\r
329 > Perhaps s/and message counts for each/with message counts/?
\r
331 > `notmuch-hello-insert-inbox':
\r
333 > Perhaps change docstring to something more consistent with other
\r
334 > notmuch-hello-insert-* functions? E.g.:
\r
336 > Insert a section displaying saved search and inbox messages for each tag.
\r
338 > + (notmuch-hello-generate-tag-alist))
\r
339 > + :filter "tag:inbox"))
\r
341 > If my above comments are correct, then :filter option should be given
\r
342 > to `notmuch-hello-generate-tag-alist' instead of
\r
343 > `notmuch-hello-insert-searches'.
\r
345 > `notmuch-hello-insert-alltags':
\r
347 > Missing dot at the end of docstring.
\r
349 > Perhaps s/and associated message counts/with message counts/?
\r
353 > - ; Jump through a hoop to get this value from the deprecated variable
\r
354 > - ; name (`notmuch-folders') or from the default value.
\r
355 > + ; Jump through a hoop to get this value from the deprecated variable
\r
356 > + ; name (`notmuch-folders') or from the default value.
\r
360 > (if (not notmuch-saved-searches)
\r
361 > - (setq notmuch-saved-searches (notmuch-saved-searches)))
\r
362 > + (setq notmuch-saved-searches (notmuch-saved-searches)))
\r
366 > + (setq notmuch-hello-first-run nil)))
\r
368 > Please move this statement to the top level. There is no need for it
\r
369 > to be inside let.
\r