Re: Applying patches directly from emails?
[notmuch-archives.git] / b6 / 4cf9846666ff6bc9edf46233897946b1c3f2ba
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 33771431FB6\r
6         for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 01:09:49 -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 KnLglAAz3Pps for <notmuch@notmuchmail.org>;\r
16         Sat, 28 Jan 2012 01:09:48 -0800 (PST)\r
17 Received: from mail-pw0-f53.google.com (mail-pw0-f53.google.com\r
18         [209.85.160.53]) (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 371BC431FAE\r
21         for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 01:09:48 -0800 (PST)\r
22 Received: by pbbb4 with SMTP id b4so3083846pbb.26\r
23         for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 01:09:47 -0800 (PST)\r
24 MIME-Version: 1.0\r
25 Received: by 10.68.189.6 with SMTP id ge6mr21709820pbc.93.1327741785529; Sat,\r
26         28 Jan 2012 01:09:45 -0800 (PST)\r
27 Received: by 10.68.236.137 with HTTP; Sat, 28 Jan 2012 01:09:45 -0800 (PST)\r
28 Received: by 10.68.236.137 with HTTP; Sat, 28 Jan 2012 01:09:45 -0800 (PST)\r
29 In-Reply-To: <1327730348-6466-1-git-send-email-dmitry.kurochkin@gmail.com>\r
30 References: <1327725684-5887-1-git-send-email-dmitry.kurochkin@gmail.com>\r
31         <1327730348-6466-1-git-send-email-dmitry.kurochkin@gmail.com>\r
32 Date: Sat, 28 Jan 2012 11:09:45 +0200\r
33 Message-ID:\r
34  <CAB+hUn8feOnr8N_mGXw+wKA6exZG3V-7uW0Yz6+wPN=B+tCNMQ@mail.gmail.com>\r
35 Subject: Re: [PATCH 8/6] emacs: use message ids instead of thread id in\r
36         `notmuch-show-operate-all'\r
37 From: Jani Nikula <jani@nikula.org>\r
38 To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
39 Content-Type: multipart/alternative; boundary=e89a8ff1c3e87ade2104b792f9ce\r
40 Cc: notmuch@notmuchmail.org\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Sat, 28 Jan 2012 09:09:49 -0000\r
54 \r
55 --e89a8ff1c3e87ade2104b792f9ce\r
56 Content-Type: text/plain; charset=UTF-8\r
57 \r
58 I guess this now includes the optimization of doing the tagging in a single\r
59 call to notmuch tag. (As opposed to calling it once per msg like it used to\r
60 be a while back.) There was some discussion about the cmdline length for\r
61 large threads potentially growing too big when I sent such an optimization\r
62 patch, shall we just ignore that and hope for the best? I guess an idea was\r
63 to limit to, say, a few hundred msg ids per command. (Again, sorry I can't\r
64 look up the earlier thread now.)\r
65 \r
66 On Jan 28, 2012 8:00 AM, "Dmitry Kurochkin" <dmitry.kurochkin@gmail.com>\r
67 wrote:\r
68 >\r
69 > Before the change, `notmuch-show-operate-all' used thread id for\r
70 > "notmuch tag" search.  This could result in tagging unexpected\r
71 > messages that were added to the thread after the notmuch-show buffer\r
72 > was created.  The patch changes `notmuch-show-operate-all' to use ids\r
73 > of shown messages to fix this.\r
74 > ---\r
75 >  emacs/notmuch-show.el |   23 ++++++++++++++++++++++-\r
76 >  1 files changed, 22 insertions(+), 1 deletions(-)\r
77 >\r
78 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
79 > index 2ca4d92..e606224 100644\r
80 > --- a/emacs/notmuch-show.el\r
81 > +++ b/emacs/notmuch-show.el\r
82 > @@ -1170,6 +1170,15 @@ All currently available key bindings:\r
83 >     (notmuch-show-move-to-message-top)\r
84 >     t))\r
85 >\r
86 > +(defun notmuch-show-mapc (function)\r
87 > +  "Iterate through all messages with\r
88 > +`notmuch-show-goto-message-next' and call `function' for side\r
89 > +effects."\r
90 > +  (save-excursion\r
91 > +    (goto-char (point-min))\r
92 > +    (loop do (funcall function)\r
93 > +         while (notmuch-show-goto-message-next))))\r
94 > +\r
95 >  ;; Functions relating to the visibility of messages and their\r
96 >  ;; components.\r
97 >\r
98 > @@ -1222,6 +1231,18 @@ Some useful entries are:\r
99 >   "Return the message id of the current message."\r
100 >   (concat "id:\"" (notmuch-show-get-prop :id) "\""))\r
101 >\r
102 > +(defun notmuch-show-get-messages-ids ()\r
103 > +  "Return all message ids of currently shown messages."\r
104 > +  (let ((message-ids))\r
105 > +    (notmuch-show-mapc\r
106 > +     (lambda () (push (notmuch-show-get-message-id) message-ids)))\r
107 > +    message-ids))\r
108 > +\r
109 > +(defun notmuch-show-get-messages-ids-search ()\r
110 > +  "Return a search string for all message ids of currently shown\r
111 > +messages."\r
112 > +  (mapconcat 'identity (notmuch-show-get-messages-ids) " or "))\r
113 > +\r
114 >  ;; dme: Would it make sense to use a macro for many of these?\r
115 >\r
116 >  (defun notmuch-show-get-filename ()\r
117 > @@ -1496,7 +1517,7 @@ i.e. a list of tags to change with '+' and '-'\r
118 prefixes."\r
119 >  `Changed-tags' is a list of tag operations for \"notmuch tag\",\r
120 >  i.e. a list of tags to change with '+' and '-' prefixes."\r
121 >   (interactive (notmuch-select-tags-with-completion nil\r
122 notmuch-show-thread-id))\r
123 > -  (apply 'notmuch-tag notmuch-show-thread-id changed-tags)\r
124 > +  (apply 'notmuch-tag (notmuch-show-get-messages-ids-search)\r
125 changed-tags)\r
126 >   (save-excursion\r
127 >     (goto-char (point-min))\r
128 >     (loop do (let* ((current-tags (notmuch-show-get-tags))\r
129 > --\r
130 > 1.7.8.3\r
131 >\r
132 > _______________________________________________\r
133 > notmuch mailing list\r
134 > notmuch@notmuchmail.org\r
135 > http://notmuchmail.org/mailman/listinfo/notmuch\r
136 \r
137 --e89a8ff1c3e87ade2104b792f9ce\r
138 Content-Type: text/html; charset=UTF-8\r
139 Content-Transfer-Encoding: quoted-printable\r
140 \r
141 <p><br>\r
142 I guess this now includes the optimization of doing the tagging in a single=\r
143  call to notmuch tag. (As opposed to calling it once per msg like it used t=\r
144 o be a while back.) There was some discussion about the cmdline length for =\r
145 large threads potentially growing too big when I sent such an optimization =\r
146 patch, shall we just ignore that and hope for the best? I guess an idea was=\r
147  to limit to, say, a few hundred msg ids per command. (Again, sorry I can&#=\r
148 39;t look up the earlier thread now.)</p>\r
149 \r
150 <p>On Jan 28, 2012 8:00 AM, &quot;Dmitry Kurochkin&quot; &lt;<a href=3D"mai=\r
151 lto:dmitry.kurochkin@gmail.com">dmitry.kurochkin@gmail.com</a>&gt; wrote:<b=\r
152 r>\r
153 &gt;<br>\r
154 &gt; Before the change, `notmuch-show-operate-all&#39; used thread id for<b=\r
155 r>\r
156 &gt; &quot;notmuch tag&quot; search. =C2=A0This could result in tagging une=\r
157 xpected<br>\r
158 &gt; messages that were added to the thread after the notmuch-show buffer<b=\r
159 r>\r
160 &gt; was created. =C2=A0The patch changes `notmuch-show-operate-all&#39; to=\r
161  use ids<br>\r
162 &gt; of shown messages to fix this.<br>\r
163 &gt; ---<br>\r
164 &gt; =C2=A0emacs/notmuch-show.el | =C2=A0 23 ++++++++++++++++++++++-<br>\r
165 &gt; =C2=A01 files changed, 22 insertions(+), 1 deletions(-)<br>\r
166 &gt;<br>\r
167 &gt; diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el<br>\r
168 &gt; index 2ca4d92..e606224 100644<br>\r
169 &gt; --- a/emacs/notmuch-show.el<br>\r
170 &gt; +++ b/emacs/notmuch-show.el<br>\r
171 &gt; @@ -1170,6 +1170,15 @@ All currently available key bindings:<br>\r
172 &gt; =C2=A0 =C2=A0 (notmuch-show-move-to-message-top)<br>\r
173 &gt; =C2=A0 =C2=A0 t))<br>\r
174 &gt;<br>\r
175 &gt; +(defun notmuch-show-mapc (function)<br>\r
176 &gt; + =C2=A0&quot;Iterate through all messages with<br>\r
177 &gt; +`notmuch-show-goto-message-next&#39; and call `function&#39; for side=\r
178 <br>\r
179 &gt; +effects.&quot;<br>\r
180 &gt; + =C2=A0(save-excursion<br>\r
181 &gt; + =C2=A0 =C2=A0(goto-char (point-min))<br>\r
182 &gt; + =C2=A0 =C2=A0(loop do (funcall function)<br>\r
183 &gt; + =C2=A0 =C2=A0 =C2=A0 =C2=A0 while (notmuch-show-goto-message-next)))=\r
184 )<br>\r
185 &gt; +<br>\r
186 &gt; =C2=A0;; Functions relating to the visibility of messages and their<br=\r
187 >\r
188 &gt; =C2=A0;; components.<br>\r
189 &gt;<br>\r
190 &gt; @@ -1222,6 +1231,18 @@ Some useful entries are:<br>\r
191 &gt; =C2=A0 &quot;Return the message id of the current message.&quot;<br>\r
192 &gt; =C2=A0 (concat &quot;id:\&quot;&quot; (notmuch-show-get-prop :id) &quo=\r
193 t;\&quot;&quot;))<br>\r
194 &gt;<br>\r
195 &gt; +(defun notmuch-show-get-messages-ids ()<br>\r
196 &gt; + =C2=A0&quot;Return all message ids of currently shown messages.&quot=\r
197 ;<br>\r
198 &gt; + =C2=A0(let ((message-ids))<br>\r
199 &gt; + =C2=A0 =C2=A0(notmuch-show-mapc<br>\r
200 &gt; + =C2=A0 =C2=A0 (lambda () (push (notmuch-show-get-message-id) message=\r
201 -ids)))<br>\r
202 &gt; + =C2=A0 =C2=A0message-ids))<br>\r
203 &gt; +<br>\r
204 &gt; +(defun notmuch-show-get-messages-ids-search ()<br>\r
205 &gt; + =C2=A0&quot;Return a search string for all message ids of currently =\r
206 shown<br>\r
207 &gt; +messages.&quot;<br>\r
208 &gt; + =C2=A0(mapconcat &#39;identity (notmuch-show-get-messages-ids) &quot=\r
209 ; or &quot;))<br>\r
210 &gt; +<br>\r
211 &gt; =C2=A0;; dme: Would it make sense to use a macro for many of these?<br=\r
212 >\r
213 &gt;<br>\r
214 &gt; =C2=A0(defun notmuch-show-get-filename ()<br>\r
215 &gt; @@ -1496,7 +1517,7 @@ i.e. a list of tags to change with &#39;+&#39; a=\r
216 nd &#39;-&#39; prefixes.&quot;<br>\r
217 &gt; =C2=A0`Changed-tags&#39; is a list of tag operations for \&quot;notmuc=\r
218 h tag\&quot;,<br>\r
219 &gt; =C2=A0i.e. a list of tags to change with &#39;+&#39; and &#39;-&#39; p=\r
220 refixes.&quot;<br>\r
221 &gt; =C2=A0 (interactive (notmuch-select-tags-with-completion nil notmuch-s=\r
222 how-thread-id))<br>\r
223 &gt; - =C2=A0(apply &#39;notmuch-tag notmuch-show-thread-id changed-tags)<b=\r
224 r>\r
225 &gt; + =C2=A0(apply &#39;notmuch-tag (notmuch-show-get-messages-ids-search)=\r
226  changed-tags)<br>\r
227 &gt; =C2=A0 (save-excursion<br>\r
228 &gt; =C2=A0 =C2=A0 (goto-char (point-min))<br>\r
229 &gt; =C2=A0 =C2=A0 (loop do (let* ((current-tags (notmuch-show-get-tags))<b=\r
230 r>\r
231 &gt; --<br>\r
232 &gt; 1.7.8.3<br>\r
233 &gt;<br>\r
234 &gt; _______________________________________________<br>\r
235 &gt; notmuch mailing list<br>\r
236 &gt; <a href=3D"mailto:notmuch@notmuchmail.org">notmuch@notmuchmail.org</a>=\r
237 <br>\r
238 &gt; <a href=3D"http://notmuchmail.org/mailman/listinfo/notmuch">http://not=\r
239 muchmail.org/mailman/listinfo/notmuch</a><br>\r
240 </p>\r
241 \r
242 --e89a8ff1c3e87ade2104b792f9ce--\r