Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / 78 / b42b81fe0ab8362e0a24e157daef9c07c38fc0
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 61246431FBC\r
6         for <notmuch@notmuchmail.org>; Sun,  8 Jul 2012 01:20:31 -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.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 25U3-2NCnBZm for <notmuch@notmuchmail.org>;\r
16         Sun,  8 Jul 2012 01:20:30 -0700 (PDT)\r
17 Received: from mail-ob0-f181.google.com (mail-ob0-f181.google.com\r
18         [209.85.214.181]) (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 79056431FAE\r
21         for <notmuch@notmuchmail.org>; Sun,  8 Jul 2012 01:20:30 -0700 (PDT)\r
22 Received: by obbup19 with SMTP id up19so14298438obb.26\r
23         for <notmuch@notmuchmail.org>; Sun, 08 Jul 2012 01:20:28 -0700 (PDT)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=google.com; s=20120113;\r
26         h=mime-version:in-reply-to:references:date:message-id:subject:from:to\r
27         :cc:content-type:x-gm-message-state;\r
28         bh=UnobBbcHrmfPPCDZ9KICABuffucwM2yARooOkwVqEQ0=;\r
29         b=WhntwzGbzlZ2WIV231+plDP3ah0gme0OEmtz8UhyV54Mrn5sHWCvdo0FbZofv0IOX8\r
30         v0EQKgHzzPGc4xrlmFcRTQhYAejt6dv205KXKnhbhu2nN0L69HUOySUlWGwTMwSnsWKe\r
31         5bcAEzy/RTyR1v43DKKdKUG5UMvv/pXVsLXPctJd7yiaTdOqmOv43k37oQzRkPmSEnSP\r
32         2+RcqFA6NOXnU+jIbmJWA1kW1rFaBImI8neFJ/SAPa8kQFjs+2vgezUw705vbcgyWY4w\r
33         hbqYWnvZtet95hCtWsOWNmNQv389wv2Qec6u4+oKoH0Gln1oprcP2SJq1pUJtt0gJclb\r
34         Z8kw==\r
35 MIME-Version: 1.0\r
36 Received: by 10.60.18.168 with SMTP id x8mr36878871oed.18.1341735628469; Sun,\r
37         08 Jul 2012 01:20:28 -0700 (PDT)\r
38 Received: by 10.76.10.102 with HTTP; Sun, 8 Jul 2012 01:20:28 -0700 (PDT)\r
39 Received: by 10.76.10.102 with HTTP; Sun, 8 Jul 2012 01:20:28 -0700 (PDT)\r
40 In-Reply-To: <87zk7aviy7.fsf@qmul.ac.uk>\r
41 References:\r
42  <37899e28dbf67e4620a53279a869be3174c02d6f.1339775602.git.jani@nikula.org>\r
43         <627aea74b0080dcd903b801042a4b2fd3868c049.1339775602.git.jani@nikula.org>\r
44         <87zk7aviy7.fsf@qmul.ac.uk>\r
45 Date: Sun, 8 Jul 2012 11:20:28 +0300\r
46 Message-ID:\r
47  <CAB+hUn-PnmG+=tDNaDVEhARjAeEUcSb2EOrxV8oUTqDX1MvW-A@mail.gmail.com>\r
48 Subject: Re: [PATCH 3/3] emacs: add notmuch hello refresh hook to display\r
49         message count change\r
50 From: Jani Nikula <jani@nikula.org>\r
51 To: Mark Walters <markwalters1009@gmail.com>\r
52 Content-Type: multipart/alternative; boundary=e89a8ff2561a84752f04c44d2bd2\r
53 X-Gm-Message-State:\r
54  ALoCoQm6n5GEvDTL9elR1plIrGnFbpd8WENq54d6YILDtkXjMrWmEVXalJJ9FTa202bgfcwRAu8L\r
55 Cc: notmuch@notmuchmail.org\r
56 X-BeenThere: notmuch@notmuchmail.org\r
57 X-Mailman-Version: 2.1.13\r
58 Precedence: list\r
59 List-Id: "Use and development of the notmuch mail system."\r
60         <notmuch.notmuchmail.org>\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
64 List-Post: <mailto:notmuch@notmuchmail.org>\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
68 X-List-Received-Date: Sun, 08 Jul 2012 08:20:31 -0000\r
69 \r
70 --e89a8ff2561a84752f04c44d2bd2\r
71 Content-Type: text/plain; charset=UTF-8\r
72 \r
73 On Jul 8, 2012 9:57 AM, "Mark Walters" <markwalters1009@gmail.com> wrote:\r
74 >\r
75 > On Fri, 15 Jun 2012, Jani Nikula <jani@nikula.org> wrote:\r
76 > > Add a notmuch hello refresh hook to display a message about change in\r
77 > > message count in the database since the notmuch-hello buffer was last\r
78 > > refreshed manually (no-display is nil).\r
79 > >\r
80 > > Signed-off-by: Jani Nikula <jani@nikula.org>\r
81 >\r
82 > Hi\r
83 >\r
84 > I just have a couple of comments/queries. First, since it breaks\r
85 > existing hooks I think it needs a NEWS item.\r
86 \r
87 Sure.\r
88 \r
89 > Secondly, I, personally, would much prefer the hook with the slight\r
90 > tweak that it counts inbox messages rather than all messages. Is that\r
91 > an option that could be put in the defcustom?\r
92 \r
93 I suppose the query could be customizable. That's simple enough; for\r
94 anything non-trivial people can write their own hooks.\r
95 \r
96 BR,\r
97 Jani.\r
98 \r
99 >\r
100 > Best wishes\r
101 >\r
102 > Mark\r
103 >\r
104 > > ---\r
105 > >  emacs/notmuch-hello.el |   27 +++++++++++++++++++++++++++\r
106 > >  1 file changed, 27 insertions(+)\r
107 > >\r
108 > > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
109 > > index bc43178..bcca044 100644\r
110 > > --- a/emacs/notmuch-hello.el\r
111 > > +++ b/emacs/notmuch-hello.el\r
112 > > @@ -148,6 +148,7 @@ International Bureau of Weights and Measures."\r
113 > >  (defcustom notmuch-hello-refresh-hook nil\r
114 > >    "Functions called after updating a `notmuch-hello' buffer."\r
115 > >    :type 'hook\r
116 > > +  :options '(notmuch-hello-refresh-status-message)\r
117 > >    :group 'notmuch-hello\r
118 > >    :group 'notmuch-hooks)\r
119 > >\r
120 > > @@ -749,6 +750,32 @@ following:\r
121 > >      (let ((fill-column (- (window-width) notmuch-hello-indent)))\r
122 > >        (center-region start (point)))))\r
123 > >\r
124 > > +(defvar notmuch-hello-refresh-count 0\r
125 > > +  "Number of messages in the database when `notmuch-hello' was last\r
126 run.\r
127 > > +\r
128 > > +Used internally by `notmuch-hello-refresh-status-message'.")\r
129 > > +\r
130 > > +(defun notmuch-hello-refresh-status-message (no-display)\r
131 > > +  "Hook to display a status message when refreshing notmuch-hello\r
132 buffer.\r
133 > > +\r
134 > > +Display a status message about the difference in message count in\r
135 > > +the database since the last call."\r
136 > > +  (unless no-display\r
137 > > +    (let* ((new-count\r
138 > > +         (string-to-number (car (process-lines notmuch-command\r
139 "count"))))\r
140 > > +        (diff-count (- new-count notmuch-hello-refresh-count)))\r
141 > > +      (cond\r
142 > > +       ((= notmuch-hello-refresh-count 0)\r
143 > > +     (message "You have %s messages."\r
144 > > +              (notmuch-hello-nice-number new-count)))\r
145 > > +       ((> diff-count 0)\r
146 > > +     (message "You have %s more messages since last refresh."\r
147 > > +              (notmuch-hello-nice-number diff-count)))\r
148 > > +       ((< diff-count 0)\r
149 > > +     (message "You have %s fewer messages since last refresh."\r
150 > > +              (notmuch-hello-nice-number (- diff-count)))))\r
151 > > +      (setq notmuch-hello-refresh-count new-count))))\r
152 > > +\r
153 > >  ;;;###autoload\r
154 > >  (defun notmuch-hello (&optional no-display)\r
155 > >    "Run notmuch and display saved searches, known tags, etc."\r
156 > > --\r
157 > > 1.7.9.5\r
158 > >\r
159 > > _______________________________________________\r
160 > > notmuch mailing list\r
161 > > notmuch@notmuchmail.org\r
162 > > http://notmuchmail.org/mailman/listinfo/notmuch\r
163 \r
164 --e89a8ff2561a84752f04c44d2bd2\r
165 Content-Type: text/html; charset=UTF-8\r
166 Content-Transfer-Encoding: quoted-printable\r
167 \r
168 <p><br>\r
169 On Jul 8, 2012 9:57 AM, &quot;Mark Walters&quot; &lt;<a href=3D"mailto:mark=\r
170 walters1009@gmail.com">markwalters1009@gmail.com</a>&gt; wrote:<br>\r
171 &gt;<br>\r
172 &gt; On Fri, 15 Jun 2012, Jani Nikula &lt;<a href=3D"mailto:jani@nikula.org=\r
173 ">jani@nikula.org</a>&gt; wrote:<br>\r
174 &gt; &gt; Add a notmuch hello refresh hook to display a message about chang=\r
175 e in<br>\r
176 &gt; &gt; message count in the database since the notmuch-hello buffer was =\r
177 last<br>\r
178 &gt; &gt; refreshed manually (no-display is nil).<br>\r
179 &gt; &gt;<br>\r
180 &gt; &gt; Signed-off-by: Jani Nikula &lt;<a href=3D"mailto:jani@nikula.org"=\r
181 >jani@nikula.org</a>&gt;<br>\r
182 &gt;<br>\r
183 &gt; Hi<br>\r
184 &gt;<br>\r
185 &gt; I just have a couple of comments/queries. First, since it breaks<br>\r
186 &gt; existing hooks I think it needs a NEWS item.</p>\r
187 <p>Sure.</p>\r
188 <p>&gt; Secondly, I, personally, would much prefer the hook with the slight=\r
189 <br>\r
190 &gt; tweak that it counts inbox messages rather than all messages. Is that<=\r
191 br>\r
192 &gt; an option that could be put in the defcustom?</p>\r
193 <p>I suppose the query could be customizable. That&#39;s simple enough; for=\r
194  anything non-trivial people can write their own hooks.</p>\r
195 <p>BR,<br>\r
196 Jani.</p>\r
197 <p>&gt;<br>\r
198 &gt; Best wishes<br>\r
199 &gt;<br>\r
200 &gt; Mark<br>\r
201 &gt;<br>\r
202 &gt; &gt; ---<br>\r
203 &gt; &gt; =C2=A0emacs/notmuch-hello.el | =C2=A0 27 ++++++++++++++++++++++++=\r
204 +++<br>\r
205 &gt; &gt; =C2=A01 file changed, 27 insertions(+)<br>\r
206 &gt; &gt;<br>\r
207 &gt; &gt; diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el<br>\r
208 &gt; &gt; index bc43178..bcca044 100644<br>\r
209 &gt; &gt; --- a/emacs/notmuch-hello.el<br>\r
210 &gt; &gt; +++ b/emacs/notmuch-hello.el<br>\r
211 &gt; &gt; @@ -148,6 +148,7 @@ International Bureau of Weights and Measures.=\r
212 &quot;<br>\r
213 &gt; &gt; =C2=A0(defcustom notmuch-hello-refresh-hook nil<br>\r
214 &gt; &gt; =C2=A0 =C2=A0&quot;Functions called after updating a `notmuch-hel=\r
215 lo&#39; buffer.&quot;<br>\r
216 &gt; &gt; =C2=A0 =C2=A0:type &#39;hook<br>\r
217 &gt; &gt; + =C2=A0:options &#39;(notmuch-hello-refresh-status-message)<br>\r
218 &gt; &gt; =C2=A0 =C2=A0:group &#39;notmuch-hello<br>\r
219 &gt; &gt; =C2=A0 =C2=A0:group &#39;notmuch-hooks)<br>\r
220 &gt; &gt;<br>\r
221 &gt; &gt; @@ -749,6 +750,32 @@ following:<br>\r
222 &gt; &gt; =C2=A0 =C2=A0 =C2=A0(let ((fill-column (- (window-width) notmuch-=\r
223 hello-indent)))<br>\r
224 &gt; &gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0(center-region start (point)))))<br>\r
225 &gt; &gt;<br>\r
226 &gt; &gt; +(defvar notmuch-hello-refresh-count 0<br>\r
227 &gt; &gt; + =C2=A0&quot;Number of messages in the database when `notmuch-he=\r
228 llo&#39; was last run.<br>\r
229 &gt; &gt; +<br>\r
230 &gt; &gt; +Used internally by `notmuch-hello-refresh-status-message&#39;.&q=\r
231 uot;)<br>\r
232 &gt; &gt; +<br>\r
233 &gt; &gt; +(defun notmuch-hello-refresh-status-message (no-display)<br>\r
234 &gt; &gt; + =C2=A0&quot;Hook to display a status message when refreshing no=\r
235 tmuch-hello buffer.<br>\r
236 &gt; &gt; +<br>\r
237 &gt; &gt; +Display a status message about the difference in message count i=\r
238 n<br>\r
239 &gt; &gt; +the database since the last call.&quot;<br>\r
240 &gt; &gt; + =C2=A0(unless no-display<br>\r
241 &gt; &gt; + =C2=A0 =C2=A0(let* ((new-count<br>\r
242 &gt; &gt; + =C2=A0 =C2=A0 =C2=A0 =C2=A0 (string-to-number (car (process-lin=\r
243 es notmuch-command &quot;count&quot;))))<br>\r
244 &gt; &gt; + =C2=A0 =C2=A0 =C2=A0 =C2=A0(diff-count (- new-count notmuch-hel=\r
245 lo-refresh-count)))<br>\r
246 &gt; &gt; + =C2=A0 =C2=A0 =C2=A0(cond<br>\r
247 &gt; &gt; + =C2=A0 =C2=A0 =C2=A0 ((=3D notmuch-hello-refresh-count 0)<br>\r
248 &gt; &gt; + =C2=A0 =C2=A0 (message &quot;You have %s messages.&quot;<br>\r
249 &gt; &gt; + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(notmuch-hello-=\r
250 nice-number new-count)))<br>\r
251 &gt; &gt; + =C2=A0 =C2=A0 =C2=A0 ((&gt; diff-count 0)<br>\r
252 &gt; &gt; + =C2=A0 =C2=A0 (message &quot;You have %s more messages since la=\r
253 st refresh.&quot;<br>\r
254 &gt; &gt; + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(notmuch-hello-=\r
255 nice-number diff-count)))<br>\r
256 &gt; &gt; + =C2=A0 =C2=A0 =C2=A0 ((&lt; diff-count 0)<br>\r
257 &gt; &gt; + =C2=A0 =C2=A0 (message &quot;You have %s fewer messages since l=\r
258 ast refresh.&quot;<br>\r
259 &gt; &gt; + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(notmuch-hello-=\r
260 nice-number (- diff-count)))))<br>\r
261 &gt; &gt; + =C2=A0 =C2=A0 =C2=A0(setq notmuch-hello-refresh-count new-count=\r
262 ))))<br>\r
263 &gt; &gt; +<br>\r
264 &gt; &gt; =C2=A0;;;###autoload<br>\r
265 &gt; &gt; =C2=A0(defun notmuch-hello (&amp;optional no-display)<br>\r
266 &gt; &gt; =C2=A0 =C2=A0&quot;Run notmuch and display saved searches, known =\r
267 tags, etc.&quot;<br>\r
268 &gt; &gt; --<br>\r
269 &gt; &gt; 1.7.9.5<br>\r
270 &gt; &gt;<br>\r
271 &gt; &gt; _______________________________________________<br>\r
272 &gt; &gt; notmuch mailing list<br>\r
273 &gt; &gt; <a href=3D"mailto:notmuch@notmuchmail.org">notmuch@notmuchmail.or=\r
274 g</a><br>\r
275 &gt; &gt; <a href=3D"http://notmuchmail.org/mailman/listinfo/notmuch">http:=\r
276 //notmuchmail.org/mailman/listinfo/notmuch</a><br>\r
277 </p>\r
278 \r
279 --e89a8ff2561a84752f04c44d2bd2--\r