Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 7c / 0ae93f652767c50ca32e1956da60419f02c43c
1 Return-Path: <daniel.schoepe@googlemail.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 272F8429E25\r
6         for <notmuch@notmuchmail.org>; Wed,  6 Jul 2011 05:41:23 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.789\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.789 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, T_MIME_NO_TEXT=0.01]\r
14         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 TSLxMfLMUHNb for <notmuch@notmuchmail.org>;\r
18         Wed,  6 Jul 2011 05:41:22 -0700 (PDT)\r
19 Received: from mail-fx0-f46.google.com (mail-fx0-f46.google.com\r
20         [209.85.161.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id 99F5F431FB6\r
23         for <notmuch@notmuchmail.org>; Wed,  6 Jul 2011 05:41:21 -0700 (PDT)\r
24 Received: by fxh19 with SMTP id 19so44674fxh.19\r
25         for <notmuch@notmuchmail.org>; Wed, 06 Jul 2011 05:41:20 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
27         d=googlemail.com; s=gamma;\r
28         h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
29         :mime-version:content-type;\r
30         bh=Q0aVt5KE5y6qfe3CGCybGlnLLw6kMTF7CsX3LFEBz/4=;\r
31         b=LNccTmnzESHy1DXF1nMDl5m3vCbDgnlOxQ3tK4mKtBGr8Ac0TiFtI4VESEy2p9wVxn\r
32         W+oIxJoNNR1acaA50CkHX11AbeSd6oOFWYE5ftTaS6zO6bt8rkUIFZVVOQIsJ2rKmC9L\r
33         phsabWY7f1xqnQ2HHKZrg3KrHEeLXCeBhHT6k=\r
34 Received: by 10.223.76.212 with SMTP id d20mr13111271fak.5.1309956079824;\r
35         Wed, 06 Jul 2011 05:41:19 -0700 (PDT)\r
36 Received: from localhost (s0744.dyn.hrz.tu-darmstadt.de [130.83.106.232])\r
37         by mx.google.com with ESMTPS id b13sm5996244fab.12.2011.07.06.05.41.17\r
38         (version=TLSv1/SSLv3 cipher=OTHER);\r
39         Wed, 06 Jul 2011 05:41:18 -0700 (PDT)\r
40 From: Daniel Schoepe <daniel.schoepe@googlemail.com>\r
41 To: Michal Sojka <sojkam1@fel.cvut.cz>, notmuch@notmuchmail.org\r
42 Subject: Re: [PATCH v3 1/2] emacs: User-defined sections in notmuch-hello\r
43 In-Reply-To: <87fwmjabii.fsf@steelpick.2x.cz>\r
44 References: <1309379221-5617-1-git-send-email-daniel.schoepe@googlemail.com>\r
45         <1309883030-28899-1-git-send-email-daniel.schoepe@googlemail.com>\r
46         <1309883030-28899-2-git-send-email-daniel.schoepe@googlemail.com>\r
47         <87fwmjabii.fsf@steelpick.2x.cz>\r
48 User-Agent: Notmuch/0.5-321-g7d7ebd8 (http://notmuchmail.org) Emacs/23.3.1\r
49         (i486-pc-linux-gnu)\r
50 Date: Wed, 06 Jul 2011 14:41:09 +0200\r
51 Message-ID: <87oc17r38a.fsf@tredergarh.home.box>\r
52 MIME-Version: 1.0\r
53 Content-Type: multipart/signed; boundary="=-=-=";\r
54         micalg=pgp-sha1; protocol="application/pgp-signature"\r
55 X-BeenThere: notmuch@notmuchmail.org\r
56 X-Mailman-Version: 2.1.13\r
57 Precedence: list\r
58 List-Id: "Use and development of the notmuch mail system."\r
59         <notmuch.notmuchmail.org>\r
60 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
62 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
63 List-Post: <mailto:notmuch@notmuchmail.org>\r
64 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
65 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
67 X-List-Received-Date: Wed, 06 Jul 2011 12:41:23 -0000\r
68 \r
69 --=-=-=\r
70 Content-Transfer-Encoding: quoted-printable\r
71 \r
72 On Wed, 06 Jul 2011 13:34:13 +0200, Michal Sojka <sojkam1@fel.cvut.cz> wrot=\r
73 e:\r
74 > > -(defcustom notmuch-hello-tag-list-make-query nil\r
75 > > -  "Function or string to generate queries for the all tags list.\r
76 >=20\r
77 > I'm not sure it is a good thing to remove customizations that are\r
78 > included in a released version. Some users may configure it and their\r
79 > configuration disappear when they install a new version. Is there a way\r
80 > to migrate this settings to a new, section-based one?\r
81 \r
82 Agreed, I think I only removed it because at the time I first\r
83 implemented user-defined sections, my patch, which introduced\r
84 notmuch-hello-tag-list-make-query, hadn't been applied yet.\r
85 \r
86 > This is IMHO still hard to understand only from looking at the\r
87 > customization widget. Ideally, I'd like to see somewhere a paragraph\r
88 > like this: "This displays a list of all tags, optionally hiding some of\r
89 > them. It is also possible to filter the list of messages matching each\r
90 > tag by an additional filter query. Similarly, the count of messages\r
91 > displayed next to the buttons can be generated by applying another\r
92 > filter to the tag query."\r
93 >=20\r
94 > Actually, when reading the above paragraph, it still seems a way too\r
95 > complex. What about the following: I do not think it has sense to list\r
96 > custom tags with zero counts - I think everybody would use\r
97 > :hide-empty-tags all the time. Then, the result of listing all tags with\r
98 > 'notmuch search-tags', filtering them with 'filter' and throwing away\r
99 > empty tags, would be the same as running 'notmuch search-tags filter'\r
100 > and then finding the counts by 'notmuch count tag:TAG and filter'. One\r
101 > of the advantage of this approach is that it would probably be faster to\r
102 > generate the section, because you won't query the counts of all tags if\r
103 > your filter matches only a few of them.\r
104 >=20\r
105 > Additionally, as I didn't read carefully your previous discussions about\r
106 > the additional filter for counts, I do not see much use for it. If you\r
107 > only want to see which tags has unread messages, you can simply add a\r
108 > new section with (:make-query "tag:unread") and you would get what you\r
109 > want. You can also disable all-tags sections.\r
110 >=20\r
111 > So my proposal is to forget about different queries for filters and\r
112 > counts and having here only the following options: filter, hide-tags and\r
113 > hide-if-empty.\r
114 >=20\r
115 > Then, the documentation would be simple: "This section displays buttons\r
116 > for all tags of messages matching a FILTER. Optionally, some of these\r
117 > tags may be hidden."\r
118 >=20\r
119 > Is there a use case, which is not covered by this?\r
120 \r
121 I'm not sure, I can imagine someone wanting to have an overview of all\r
122 his tags, whether there are, e.g., unread messages or not. If we decide\r
123 to keep this functionality, it should be inverted though, i.e. one has\r
124 to explicitly specify :show-empty-searches to get them.\r
125 \r
126 About the counts: I introduced this because Austin Clements says he\r
127 finds it useful in his comment here:\r
128 \r
129 id:"BANLkTi=3D729DWai4q57iBSfz1wDhBXsmndQ@mail.gmail.com"\r
130 \r
131 Also, I think/hope that we can just improve the documentation\r
132 sufficiently without sacrificing flexibility.\r
133 \r
134 >=20\r
135 > > +  :type\r
136 > > +  (let ((opts\r
137 > > +    '((:title (string :tag "Title for this section"))\r
138 > > +      (:make-query (string :tag "Filter for each tag"))\r
139 > > +      (:make-count (string :tag "Different query to generate counts"))\r
140 > > +      (:hide-tags (repeat :tag "Tags that will be hidden" string))\r
141 >=20\r
142 > I can imagine, that :hide-tags could also be a (list of) regexp(es).\r
143 >=20\r
144 > > +      (:initially-hidden (boolean :tag "Hide this on startup?"))\r
145 >=20\r
146 > This is IMHO not needed here, as you always has to enable this section\r
147 > manually.\r
148 \r
149 A user might still want to have the section collapsed when starting the\r
150 notmuch UI and only have it shown when he needs it. (I use that for a\r
151 section that displays unread counts for each tag).\r
152 \r
153 >=20\r
154 > > +            (:hide-empty-tags\r
155 >=20\r
156 > Rename to :hide-empty-queries.\r
157 >=20\r
158 > > +             (boolean :tag "Hide tags with no matching messages"))\r
159 >=20\r
160 > Hide queries...\r
161 \r
162 Right, thanks.\r
163 \r
164 >=20\r
165 > > +            (:hide-if-empty (boolean :tag "Hide if empty"))))))\r
166 > > +\r
167 > > +(defcustom notmuch-hello-sections\r
168 > > +  (list #'notmuch-hello-insert-header\r
169 > > +   #'notmuch-hello-insert-saved-searches\r
170 > > +   #'notmuch-hello-insert-search\r
171 > > +   #'notmuch-hello-insert-recent-searches\r
172 > > +   #'notmuch-hello-insert-alltags\r
173 > > +   #'notmuch-hello-insert-footer)\r
174 > > +  "Sections for notmuch-hello.\r
175 > > +\r
176 > > +Each entry of this list should be a function of no arguments that\r
177 > > +should return if notmuch-hello-target is produced as part of its\r
178 >=20\r
179 > What is notmuch-hello-target? I guess I know what it is from reading the\r
180 > code, but if I didn't read the code, this mentioning it here would be of\r
181 > little value for me. Perhaps make the notmuch-hello-target clickable and\r
182 > document it below.\r
183 \r
184 Yes, you're right, this needs more documentation.\r
185 \r
186 >=20\r
187 > > +output and nil otherwise. For convenience an element can also be\r
188 > > +a list of the form (FUNC ARG1 ARG2 .. ARGN) in which case FUNC\r
189 > > +will be applied to the rest of the list.\r
190 > > +\r
191 > > +The functions will be run to construct the content of the\r
192 > > +notmuch-hello buffer in the order they appear in this list."\r
193 > > +  :group 'notmuch\r
194 > > +  :type=20\r
195 > > +  '(repeat\r
196 > > +    (choice (function-item notmuch-hello-insert-header)\r
197 > > +       (function-item notmuch-hello-insert-saved-searches)\r
198 > > +       (function-item notmuch-hello-insert-search)\r
199 > > +       (function-item notmuch-hello-insert-recent-searches)\r
200 > > +       (function-item notmuch-hello-insert-alltags)\r
201 > > +       (function-item notmuch-hello-insert-footer)\r
202 > > +       (function-item notmuch-hello-insert-inbox)\r
203 > > +       notmuch-hello-tags-section\r
204 > > +       notmuch-hello-query-section\r
205 > > +       (function :tag "Custom function"))))\r
206 > > +\r
207 > > +;; only defined to avoid compilation warnings about free variables\r
208 > > +(defvar notmuch-hello-target nil)\r
209 >=20\r
210 > Add the documentation as discussed above. Additionally, it seems that\r
211 > having only the label in this variable is not enough, since the same\r
212 > label can appear in multiple sections. Perhaps, we need both the title\r
213 > of the section and the label here.\r
214 \r
215 What do you mean by label? "Custom function"? If yes, that element will\r
216 have the actual function name in the input element next to it anyway.\r
217 \r
218 > > +  ;;(setq buffer-read-only t)\r
219 >=20\r
220 > Don't we want to get rid of this line?\r
221 \r
222 I guess so, it was there before my patch though.\r
223 \r
224 >=20\r
225 > > +  )\r
226 > > +\r
227 > > +(defun notmuch-hello-generate-tag-alist (&optional hide-tags filter-qu=\r
228 ery filter-count)\r
229 > >    "Return an alist from tags to queries to display in the all-tags sec=\r
230 tion."\r
231 > >    (notmuch-remove-if-not\r
232 > > -   #'cdr\r
233 > > +   #'identity\r
234 > >     (mapcar (lambda (tag)\r
235 > > -        (cons tag\r
236 > > -              (cond\r
237 > > -               ((functionp notmuch-hello-tag-list-make-query)\r
238 > > -                (concat "tag:" tag " and ("\r
239 > > -                        (funcall notmuch-hello-tag-list-make-query tag) ")"))\r
240 > > -               ((stringp notmuch-hello-tag-list-make-query)\r
241 > > -                (concat "tag:" tag " and ("\r
242 > > -                        notmuch-hello-tag-list-make-query ")"))\r
243 > > -               (t (concat "tag:" tag)))))\r
244 > > +        (let ((query (notmuch-hello-filtered-query (concat "tag:" tag)\r
245 > > +                                                   filter-query)))\r
246 > > +          (when query\r
247 > > +            (if filter-count\r
248 > > +                (list tag (notmuch-hello-filtered-query tag filter-query)\r
249 > > +                      (notmuch-hello-filtered-query (concat "tag:" tag)\r
250 > > +                                                    filter-count))\r
251 > > +              (cons tag (notmuch-hello-filtered-query\r
252 > > +                         (concat "tag:" tag) filter-query))))))\r
253 > >        (notmuch-remove-if-not\r
254 > >         (lambda (tag)\r
255 > > -         (not (member tag notmuch-hello-hide-tags)))\r
256 > > +         (not (member tag hide-tags)))\r
257 > >         (process-lines notmuch-command "search-tags")))))\r
258 > >=20=20\r
259 > > +(defun notmuch-hello-insert-header ()\r
260 > > +  "Insert the default notmuch-hello header."\r
261 > > +  (when notmuch-show-logo\r
262 > > +    (let ((image notmuch-hello-logo))\r
263 > > +      ;; The notmuch logo uses transparency. That can display poorly\r
264 > > +      ;; when inserting the image into an emacs buffer (black logo on\r
265 > > +      ;; a black background), so force the background colour of the\r
266 > > +      ;; image. We use a face to represent the colour so that\r
267 > > +      ;; `defface' can be used to declare the different possible\r
268 > > +      ;; colours, which depend on whether the frame has a light or\r
269 > > +      ;; dark background.\r
270 > > +      (setq image (cons 'image\r
271 > > +                   (append (cdr image)\r
272 > > +                           (list :background (face-background 'notmuch-hello-logo-background)=\r
273 ))))\r
274 > > +      (insert-image image))\r
275 > > +    (widget-insert "  "))\r
276 > > +\r
277 > > +  (widget-insert "Welcome to ")\r
278 > > +  ;; Hack the display of the links used.\r
279 > > +  (let ((widget-link-prefix "")\r
280 > > +   (widget-link-suffix ""))\r
281 > > +    (widget-create 'link\r
282 > > +              :notify (lambda (&rest ignore)\r
283 > > +                        (browse-url notmuch-hello-url))\r
284 > > +              :help-echo "Visit the notmuch website."\r
285 > > +              "notmuch")\r
286 > > +    (widget-insert ". ")\r
287 > > +    (widget-insert "You have ")\r
288 > > +    (widget-create 'link\r
289 > > +              :notify (lambda (&rest ignore)\r
290 > > +                        (notmuch-hello-update))\r
291 > > +              :help-echo "Refresh"\r
292 > > +              (notmuch-hello-nice-number\r
293 > > +               (string-to-number (car (process-lines notmuch-command "count")))=\r
294 ))\r
295 > > +    (widget-insert " messages.")))\r
296 >=20\r
297 > Perhaps you want to end this (and also all other) section with an empty\r
298 > line so that the order of sections doesn't matter. I use sections in\r
299 > this order: header, inbox, saved-searches and there is no space between\r
300 > header and inbox and two spaces between inbox and saved-searches.\r
301 \r
302 My thinking was to have no section end with a newline and insert a\r
303 newline between each section when building the notmuch-hello buffer, to\r
304 prevent forgotten trailing newlines when defining a new section.\r
305 \r
306 > I might be useful to include here a link to the customization of this\r
307 > page. Maybe, it would be useful to have notmuch-hello subgroup in\r
308 > customization interface and link to this group. But creation of the\r
309 > subgroup should be definitely in a separate patch.\r
310 \r
311 Yes definitely. Pieter Praet recently sent a patch reorganizing the\r
312 customization options into subgroups, so I'll change it once that patch\r
313 has been applied.\r
314 \r
315 Cheers,\r
316 Daniel\r
317 \r
318 --=-=-=\r
319 Content-Type: application/pgp-signature\r
320 \r
321 -----BEGIN PGP SIGNATURE-----\r
322 Version: GnuPG v1.4.11 (GNU/Linux)\r
323 \r
324 iQIcBAEBAgAGBQJOFFflAAoJEIaTAtce+Z+J4zgQAIVBNWufY2dbYvTsWLUexJBf\r
325 ATbk3NfNvme2VnpNnTSRsrWLUuXzEbgqch0j08NDqdK1eh89NGOgbHhRSuRSqKAu\r
326 sIFEO2fIDfS9iPl+MxpBZJS3F6tSUnjIiD8JIerAM590rCufRsglfRPOwyX2cdhY\r
327 xPhVLYIN+9hStdEGtNl4NHiEMzDvdsYPqU+tSgSpA6t9kZXFRw8qg6s87+W+1m9s\r
328 o0nL16mM6UyYRABrTEpIeZA4NmKzZDoJkc8N3+nMvJ8w7I3wYjaf+8cf20+uJf6S\r
329 X707vktct6vgJ6U3QEapzXYqUBKKyRcgfZZg5Ui5689SZpf3/FQ8Kjx064IYxWQJ\r
330 M/ixMExRLtIeezE2nRJc/XNtOxnEe9x0K4emTuX+xCN49g4XARw4OJbG3IJfFZcN\r
331 r4qDl3SLs++q/y3liEVx2CMyacDR67cHN8S6FcmgXFM+uxZST+YJruR3/+QUEc9T\r
332 YFbcggGmhX6iSDN5UF31hVK9MS5ehRJiOVbKiCzgCgn7ARv88hlxMNSPQA8OeAMW\r
333 bF5of3tAm2Ec5d1RmJe0vsNXOi+he+GJZJ3a9rhTxNKDWHtaHNAyluukaOAzSH1D\r
334 DUYyocVz2mkcX6Gu/rsfVzoTk8tTY96XZz+aiRkpTD1bSpLzfrdkJRLNpP1F2Jmm\r
335 duzLXx5JyZv+cL212f3x\r
336 =bYeE\r
337 -----END PGP SIGNATURE-----\r
338 --=-=-=--\r