Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / f6 / 75c27fe07c425f7897b0343265f9204dea09a4
1 Return-Path: <jani@nikula.org>\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 874BA431FAF\r
6         for <notmuch@notmuchmail.org>; Tue,  6 Mar 2012 00:20: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: -0.699\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
12         tests=[HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 2w-l4cFUj+9W for <notmuch@notmuchmail.org>;\r
16         Tue,  6 Mar 2012 00:20:25 -0800 (PST)\r
17 Received: from mail-pz0-f45.google.com (mail-pz0-f45.google.com\r
18         [209.85.210.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 79689431FAE\r
21         for <notmuch@notmuchmail.org>; Tue,  6 Mar 2012 00:20:25 -0800 (PST)\r
22 Received: by dadp14 with SMTP id p14so4753431dad.18\r
23         for <notmuch@notmuchmail.org>; Tue, 06 Mar 2012 00:20:23 -0800 (PST)\r
24 Received-SPF: pass (google.com: domain of jani@nikula.org designates\r
25         10.68.239.195 as permitted sender) client-ip=10.68.239.195; \r
26 Authentication-Results: mr.google.com;\r
27         spf=pass (google.com: domain of jani@nikula.org\r
28         designates 10.68.239.195 as permitted sender)\r
29         smtp.mail=jani@nikula.org\r
30 Received: from mr.google.com ([10.68.239.195])\r
31         by 10.68.239.195 with SMTP id vu3mr29119326pbc.49.1331022023585\r
32         (num_hops = 1); Tue, 06 Mar 2012 00:20:23 -0800 (PST)\r
33 MIME-Version: 1.0\r
34 Received: by 10.68.239.195 with SMTP id vu3mr25105581pbc.49.1331022023409;\r
35         Tue, 06 Mar 2012 00:20:23 -0800 (PST)\r
36 Received: by 10.68.12.103 with HTTP; Tue, 6 Mar 2012 00:20:23 -0800 (PST)\r
37 Received: by 10.68.12.103 with HTTP; Tue, 6 Mar 2012 00:20:23 -0800 (PST)\r
38 In-Reply-To: <87zkbukb59.fsf@gmail.com>\r
39 References: <1330613059-5130-1-git-send-email-daniel@schoepe.org>\r
40         <1330613059-5130-2-git-send-email-daniel@schoepe.org>\r
41         <CAB+hUn-iQbXq_UDcj97h2Duq=gJdxpiJjOn6YzmVcZw+GEgK0A@mail.gmail.com>\r
42         <87zkbukb59.fsf@gmail.com>\r
43 Date: Tue, 6 Mar 2012 10:20:23 +0200\r
44 Message-ID:\r
45  <CAB+hUn-jcxyS8wR7UfC1skRsUtF+r04hCc-oVrBwUsvZefNPzw@mail.gmail.com>\r
46 Subject: Re: [PATCH v2] emacs: Pass a copy to\r
47         notmuch-saved-search-sort-function\r
48 From: Jani Nikula <jani@nikula.org>\r
49 To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
50 Content-Type: multipart/alternative; boundary=047d7b33d5cce4bfa104ba8eb662\r
51 X-Gm-Message-State:\r
52  ALoCoQkkZWmRJUzPGJ8IzVvJjStyYZMwy7rS9BfK1ngtNpK3IOwCF2KBhsmx6irk5rzMTkA9fbvg\r
53 Cc: notmuch@notmuchmail.org\r
54 X-BeenThere: notmuch@notmuchmail.org\r
55 X-Mailman-Version: 2.1.13\r
56 Precedence: list\r
57 List-Id: "Use and development of the notmuch mail system."\r
58         <notmuch.notmuchmail.org>\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
62 List-Post: <mailto:notmuch@notmuchmail.org>\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
66 X-List-Received-Date: Tue, 06 Mar 2012 08:20:29 -0000\r
67 \r
68 --047d7b33d5cce4bfa104ba8eb662\r
69 Content-Type: text/plain; charset=UTF-8\r
70 \r
71 On Mar 5, 2012 11:11 PM, "Dmitry Kurochkin" <dmitry.kurochkin@gmail.com>\r
72 wrote:\r
73 >\r
74 > On Mon, 5 Mar 2012 22:55:54 +0200, Jani Nikula <jani@nikula.org> wrote:\r
75 > > On Mar 5, 2012 5:43 PM, "Dmitry Kurochkin" <dmitry.kurochkin@gmail.com>\r
76 > > wrote:\r
77 > > >\r
78 > > > On Mon, 05 Mar 2012 12:17:43 +0100, Daniel Schoepe <daniel@schoepe.org\r
79 >\r
80 > > wrote:\r
81 > > > > On Mon, 05 Mar 2012 06:21:52 +0400, Dmitry Kurochkin <\r
82 > > dmitry.kurochkin@gmail.com> wrote:\r
83 > > > > > On Thu,  1 Mar 2012 21:24:38 +0100, Daniel Schoepe <\r
84 daniel@schoepe.org>\r
85 > > wrote:\r
86 > > > > > > notmuch-saved-search-sort-function might destructively modify\r
87 its\r
88 > > > > > > input (`sort' does that, for instance), so it should not be\r
89 given\r
90 > > > > > > notmuch-saved-searches directly.\r
91 > > > > > > ---\r
92 > > > > >\r
93 > > > > > -1\r
94 > > > > >\r
95 > > > > > I think we should require `notmuch-saved-search-sort-function'\r
96 not to\r
97 > > > > > have side effects.  Current documentation should be more clear\r
98 about\r
99 > > > > > this.  We need to fix `notmuch-sort-saved-searches' to copy the\r
100 list\r
101 > > > > > before calling `sort'.  But we should not do it in\r
102 > > > > > `notmuch-hello-insert-saved-searches' for any sorting function\r
103 (which\r
104 > > > > > may not need this copying).\r
105 > > > >\r
106 > > > > My reasoning was that since sort is such a common function, many\r
107 users\r
108 > > > > will probably use sort for their own sorting functions, not\r
109 realizing\r
110 > > > > that it has side effects. This will lead to confusing behavior\r
111 that's\r
112 > > > > not so easy to track down.\r
113 > > > >\r
114 > > > > Copying the list of saved searches when running notmuch-hello does\r
115 not\r
116 > > > > seem be relevant to performance to me, since it's a) not called that\r
117 > > > > often and b) the list of saved searches will rarely exceed 30\r
118 elements.\r
119 > > > >\r
120 > > > > Hence, this way we can avoid some headaches for users who define\r
121 their\r
122 > > > > own sorting functions at a negligible (performance) cost.\r
123 Incidentally,\r
124 > > > > this is also how notmuch-hello did it before the user-defined\r
125 sections\r
126 > > > > patches.\r
127 > > > >\r
128 > > >\r
129 > > > I do not buy the argument that we should help users who implement\r
130 their\r
131 > > > own sorting functions but do not read documentation for functions they\r
132 > > > use.  Apparently, those who implemented the `sort' function had\r
133 similar\r
134 > > > ideas.  And I do not think it is our job to add workarounds for it.\r
135 > > >\r
136 > > > An alternative (and IMO better) solution would be to allow\r
137 customization\r
138 > > > of compare function used for sorting instead of the sorting function\r
139 > > > itself.\r
140 > >\r
141 > > Providing the customization of the sort function is more powerful than\r
142 the\r
143 > > compare function. In the case of saved searches I can imagine people\r
144 might\r
145 > > want to partially use the original order while sort the rest (e.g.\r
146 > > important ones first in predefined order, others sorted).\r
147 >\r
148 > Valid point.\r
149 >\r
150 > > In fact this also\r
151 > > allows dropping out some elements. And renaming. And changing the\r
152 queries...\r
153 > >\r
154 > > (I had something like that in mind originally but then settled with just\r
155 > > capitalizing the important ones to show them first.)\r
156 > >\r
157 >\r
158 > All of these are invalid usages of `notmuch-saved-search-sort-function'.\r
159 > The function is meant for sorting only (hence the name).  So the code\r
160 > might assume that the function does only sorting.\r
161 >\r
162 > I do not understand why we need such functionality (renaming,\r
163 > capitalizing, etc.).  You can just rename the query itself if you want\r
164 > to.  Should be easier IMO.\r
165 \r
166 Just for the record, I have a few important searches capitalized in the\r
167 saved searches and just use the regular sort. Capitalized entries sort\r
168 before the lowercase ones.\r
169 \r
170 > But if we need such functionality, we should\r
171 > not misuse sorting function for it.  We can add `notmuch-saved-searches'\r
172 > function which would return saved searches list (sorted, renamed and\r
173 > mangled in any other way).  By default it would return\r
174 > `notmuch-saved-searches' variable as is.\r
175 \r
176 Agreed.\r
177 \r
178 As to the problem at hand, we should just fix the sort function not to\r
179 modify its input. I wouldn't hold my breath waiting for someone to provide\r
180 patches for the rest...\r
181 \r
182 BR,\r
183 Jani.\r
184 \r
185 --047d7b33d5cce4bfa104ba8eb662\r
186 Content-Type: text/html; charset=UTF-8\r
187 Content-Transfer-Encoding: quoted-printable\r
188 \r
189 <p><br>\r
190 On Mar 5, 2012 11:11 PM, &quot;Dmitry Kurochkin&quot; &lt;<a href=3D"mailto=\r
191 :dmitry.kurochkin@gmail.com">dmitry.kurochkin@gmail.com</a>&gt; wrote:<br>\r
192 &gt;<br>\r
193 &gt; On Mon, 5 Mar 2012 22:55:54 +0200, Jani Nikula &lt;<a href=3D"mailto:j=\r
194 ani@nikula.org">jani@nikula.org</a>&gt; wrote:<br>\r
195 &gt; &gt; On Mar 5, 2012 5:43 PM, &quot;Dmitry Kurochkin&quot; &lt;<a href=\r
196 =3D"mailto:dmitry.kurochkin@gmail.com">dmitry.kurochkin@gmail.com</a>&gt;<b=\r
197 r>\r
198 &gt; &gt; wrote:<br>\r
199 &gt; &gt; &gt;<br>\r
200 &gt; &gt; &gt; On Mon, 05 Mar 2012 12:17:43 +0100, Daniel Schoepe &lt;<a hr=\r
201 ef=3D"mailto:daniel@schoepe.org">daniel@schoepe.org</a>&gt;<br>\r
202 &gt; &gt; wrote:<br>\r
203 &gt; &gt; &gt; &gt; On Mon, 05 Mar 2012 06:21:52 +0400, Dmitry Kurochkin &l=\r
204 t;<br>\r
205 &gt; &gt; <a href=3D"mailto:dmitry.kurochkin@gmail.com">dmitry.kurochkin@gm=\r
206 ail.com</a>&gt; wrote:<br>\r
207 &gt; &gt; &gt; &gt; &gt; On Thu, =C2=A01 Mar 2012 21:24:38 +0100, Daniel Sc=\r
208 hoepe &lt;<a href=3D"mailto:daniel@schoepe.org">daniel@schoepe.org</a>&gt;<=\r
209 br>\r
210 &gt; &gt; wrote:<br>\r
211 &gt; &gt; &gt; &gt; &gt; &gt; notmuch-saved-search-sort-function might dest=\r
212 ructively modify its<br>\r
213 &gt; &gt; &gt; &gt; &gt; &gt; input (`sort&#39; does that, for instance), s=\r
214 o it should not be given<br>\r
215 &gt; &gt; &gt; &gt; &gt; &gt; notmuch-saved-searches directly.<br>\r
216 &gt; &gt; &gt; &gt; &gt; &gt; ---<br>\r
217 &gt; &gt; &gt; &gt; &gt;<br>\r
218 &gt; &gt; &gt; &gt; &gt; -1<br>\r
219 &gt; &gt; &gt; &gt; &gt;<br>\r
220 &gt; &gt; &gt; &gt; &gt; I think we should require `notmuch-saved-search-so=\r
221 rt-function&#39; not to<br>\r
222 &gt; &gt; &gt; &gt; &gt; have side effects. =C2=A0Current documentation sho=\r
223 uld be more clear about<br>\r
224 &gt; &gt; &gt; &gt; &gt; this. =C2=A0We need to fix `notmuch-sort-saved-sea=\r
225 rches&#39; to copy the list<br>\r
226 &gt; &gt; &gt; &gt; &gt; before calling `sort&#39;. =C2=A0But we should not=\r
227  do it in<br>\r
228 &gt; &gt; &gt; &gt; &gt; `notmuch-hello-insert-saved-searches&#39; for any =\r
229 sorting function (which<br>\r
230 &gt; &gt; &gt; &gt; &gt; may not need this copying).<br>\r
231 &gt; &gt; &gt; &gt;<br>\r
232 &gt; &gt; &gt; &gt; My reasoning was that since sort is such a common funct=\r
233 ion, many users<br>\r
234 &gt; &gt; &gt; &gt; will probably use sort for their own sorting functions,=\r
235  not realizing<br>\r
236 &gt; &gt; &gt; &gt; that it has side effects. This will lead to confusing b=\r
237 ehavior that&#39;s<br>\r
238 &gt; &gt; &gt; &gt; not so easy to track down.<br>\r
239 &gt; &gt; &gt; &gt;<br>\r
240 &gt; &gt; &gt; &gt; Copying the list of saved searches when running notmuch=\r
241 -hello does not<br>\r
242 &gt; &gt; &gt; &gt; seem be relevant to performance to me, since it&#39;s a=\r
243 ) not called that<br>\r
244 &gt; &gt; &gt; &gt; often and b) the list of saved searches will rarely exc=\r
245 eed 30 elements.<br>\r
246 &gt; &gt; &gt; &gt;<br>\r
247 &gt; &gt; &gt; &gt; Hence, this way we can avoid some headaches for users w=\r
248 ho define their<br>\r
249 &gt; &gt; &gt; &gt; own sorting functions at a negligible (performance) cos=\r
250 t. Incidentally,<br>\r
251 &gt; &gt; &gt; &gt; this is also how notmuch-hello did it before the user-d=\r
252 efined sections<br>\r
253 &gt; &gt; &gt; &gt; patches.<br>\r
254 &gt; &gt; &gt; &gt;<br>\r
255 &gt; &gt; &gt;<br>\r
256 &gt; &gt; &gt; I do not buy the argument that we should help users who impl=\r
257 ement their<br>\r
258 &gt; &gt; &gt; own sorting functions but do not read documentation for func=\r
259 tions they<br>\r
260 &gt; &gt; &gt; use. =C2=A0Apparently, those who implemented the `sort&#39; =\r
261 function had similar<br>\r
262 &gt; &gt; &gt; ideas. =C2=A0And I do not think it is our job to add workaro=\r
263 unds for it.<br>\r
264 &gt; &gt; &gt;<br>\r
265 &gt; &gt; &gt; An alternative (and IMO better) solution would be to allow c=\r
266 ustomization<br>\r
267 &gt; &gt; &gt; of compare function used for sorting instead of the sorting =\r
268 function<br>\r
269 &gt; &gt; &gt; itself.<br>\r
270 &gt; &gt;<br>\r
271 &gt; &gt; Providing the customization of the sort function is more powerful=\r
272  than the<br>\r
273 &gt; &gt; compare function. In the case of saved searches I can imagine peo=\r
274 ple might<br>\r
275 &gt; &gt; want to partially use the original order while sort the rest (e.g=\r
276 .<br>\r
277 &gt; &gt; important ones first in predefined order, others sorted).<br>\r
278 &gt;<br>\r
279 &gt; Valid point.<br>\r
280 &gt;<br>\r
281 &gt; &gt; In fact this also<br>\r
282 &gt; &gt; allows dropping out some elements. And renaming. And changing the=\r
283  queries...<br>\r
284 &gt; &gt;<br>\r
285 &gt; &gt; (I had something like that in mind originally but then settled wi=\r
286 th just<br>\r
287 &gt; &gt; capitalizing the important ones to show them first.)<br>\r
288 &gt; &gt;<br>\r
289 &gt;<br>\r
290 &gt; All of these are invalid usages of `notmuch-saved-search-sort-function=\r
291 &#39;.<br>\r
292 &gt; The function is meant for sorting only (hence the name). =C2=A0So the =\r
293 code<br>\r
294 &gt; might assume that the function does only sorting.<br>\r
295 &gt;<br>\r
296 &gt; I do not understand why we need such functionality (renaming,<br>\r
297 &gt; capitalizing, etc.). =C2=A0You can just rename the query itself if you=\r
298  want<br>\r
299 &gt; to. =C2=A0Should be easier IMO. =C2=A0</p>\r
300 <p>Just for the record, I have a few important searches capitalized in the =\r
301 saved searches and just use the regular sort. Capitalized entries sort befo=\r
302 re the lowercase ones.</p>\r
303 <p>&gt; But if we need such functionality, we should<br>\r
304 &gt; not misuse sorting function for it. =C2=A0We can add `notmuch-saved-se=\r
305 arches&#39;<br>\r
306 &gt; function which would return saved searches list (sorted, renamed and<b=\r
307 r>\r
308 &gt; mangled in any other way). =C2=A0By default it would return<br>\r
309 &gt; `notmuch-saved-searches&#39; variable as is.</p>\r
310 <p>Agreed.</p>\r
311 <p>As to the problem at hand, we should just fix the sort function not to m=\r
312 odify its input. I wouldn&#39;t hold my breath waiting for someone to provi=\r
313 de patches for the rest...</p>\r
314 <p>BR,<br>\r
315 Jani.<br>\r
316 </p>\r
317 \r
318 --047d7b33d5cce4bfa104ba8eb662--\r