1 Return-Path: <dme@dme.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 BDAB0431FC7
\r
6 for <notmuch@notmuchmail.org>; Mon, 12 May 2014 07:03:55 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[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 9CpyCc9Pwv-4 for <notmuch@notmuchmail.org>;
\r
16 Mon, 12 May 2014 07:03:48 -0700 (PDT)
\r
17 Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com
\r
18 [209.85.212.179]) (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 6A4C0431FC2
\r
21 for <notmuch@notmuchmail.org>; Mon, 12 May 2014 07:03:48 -0700 (PDT)
\r
22 Received: by mail-wi0-f179.google.com with SMTP id bs8so4544564wib.0
\r
23 for <notmuch@notmuchmail.org>; Mon, 12 May 2014 07:03:47 -0700 (PDT)
\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=1e100.net; s=20130820;
\r
26 h=x-gm-message-state:to:subject:in-reply-to:references:user-agent
\r
27 :from:date:message-id:mime-version:content-type;
\r
28 bh=XuLwkods7RoBbL5/MTlmcMSwWPbbHGDonFxElR8XgBA=;
\r
29 b=UAIDtPh+Q8jOYRYbR5IA+2mcqj3szSf/1S8DL51aGtfRnjQJgx2rrAQeLGCFpaC9tn
\r
30 XK+uEybT1+PnRckyK4e6gHbqLYXDgdEk3EC2DEIQH6ONgoxrqvs3fVKwd1AqLPe4NWdg
\r
31 knNatoUx00o1OpxLp4jc9loMw8RirdqILq4P3miUiR/H0msUkKa02wMm9v1yqa+jVI5m
\r
32 XvLOoJB0TLqQwyuCLb7dpUiR3PQQYwlDgfWyFOFRFeZnvVKLIuoFWfgfKOqYpb5Ky1Nt
\r
33 YFh+uxOVOlHrWeV+hyyJRaGaT/yZyFJgB3qOcSpVUsKi8Qmhfk36JWBIz+nIH5oGv8Z1
\r
36 ALoCoQn+eBxQdUmA5Jq2+S0eNSBZyqQ3FgsyUErv0PNWQfageAuD/u9N79oBNxEggFj/1uFyYuDI
\r
37 X-Received: by 10.180.39.178 with SMTP id q18mr15976462wik.56.1399903427132;
\r
38 Mon, 12 May 2014 07:03:47 -0700 (PDT)
\r
39 Received: from localhost ([2a01:348:1a2:1:a288:b4ff:fe8a:77d8])
\r
40 by mx.google.com with ESMTPSA id ht5sm8605285wjb.49.2014.05.12.07.03.45
\r
41 for <multiple recipients>
\r
42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
43 Mon, 12 May 2014 07:03:45 -0700 (PDT)
\r
44 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
\r
45 Subject: Re: [PATCH 2/7] emacs: hello: allow saved search display functions
\r
46 In-Reply-To: <1399797282-20389-3-git-send-email-markwalters1009@gmail.com>
\r
47 References: <1399797282-20389-1-git-send-email-markwalters1009@gmail.com>
\r
48 <1399797282-20389-3-git-send-email-markwalters1009@gmail.com>
\r
49 User-Agent: Notmuch/0.18 (http://notmuchmail.org) Emacs/24.3.1
\r
50 (x86_64-pc-linux-gnu)
\r
51 From: David Edmondson <dme@dme.org>
\r
52 Date: Mon, 12 May 2014 15:03:41 +0100
\r
53 Message-ID: <cuniopb6qma.fsf@hotblack-desiato.hh.sledj.net>
\r
55 Content-Type: multipart/signed; boundary="=-=-=";
\r
56 micalg=pgp-sha1; protocol="application/pgp-signature"
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Mon, 12 May 2014 14:03:55 -0000
\r
72 Content-Type: text/plain
\r
73 Content-Transfer-Encoding: quoted-printable
\r
75 On Sun, May 11 2014, Mark Walters wrote:
\r
76 > Extend the saved search plist to include a :display-function property
\r
77 > that can customise the display of the saved search. It can change the
\r
78 > count string displayed and the name string. Thus the user can
\r
79 > customise so that a particular search:
\r
81 > does not show a count (and is thus hello is faster), shows a thread
\r
82 > count, show a combined message/thread count, changes colour of the
\r
83 > search button based on new messages arriving etc.
\r
85 > The display function should use (&rest args) to take a keyword list of
\r
86 > arguments. The advantage of this is that it is easy to add extra
\r
87 > arguments in a backwards compatible way (existing user scripts will
\r
90 > If a user uses this it will not take advantage of the batch counting
\r
91 > currently done so will make things slower over remote links (except in
\r
92 > cases where no query is done!).
\r
94 > It also deletes the :count-query option from the customise for saved
\r
95 > searches as this method is much more general. The code still supports
\r
96 > the :count-query option though (just the defcustom does not).
\r
98 > emacs/notmuch-hello.el | 47 +++++++++++++++++++++++++++++++-----------=
\r
100 > 1 file changed, 31 insertions(+), 16 deletions(-)
\r
102 > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
103 > index 0a7004c..7075860 100644
\r
104 > --- a/emacs/notmuch-hello.el
\r
105 > +++ b/emacs/notmuch-hello.el
\r
106 > @@ -85,12 +85,13 @@ (define-widget 'notmuch-saved-search-plist 'list
\r
107 > (group :format "%v" :inline t (const :format " Query: " :query) (stri=
\r
109 > (checklist :inline t
\r
111 > - (group :format "%v" :inline t (const :format "Count-Query: " :cou=
\r
112 nt-query) (string :format "%v"))
\r
113 > (group :format "%v" :inline t (const :format "" :sort-order)
\r
114 > (choice :tag " Sort Order"
\r
115 > (const :tag "Default" nil)
\r
116 > (const :tag "Oldest-first" oldest-first)
\r
117 > - (const :tag "Newest-first" newest-first))))))
\r
118 > + (const :tag "Newest-first" newest-first)))
\r
119 > + (group :format "%v" :inline t (const :format "Display-function: "=
\r
120 :display-function) (function :format "%v")))))
\r
123 > (defcustom notmuch-saved-searches '((:name "inbox" :query "tag:inbox")
\r
124 > (:name "unread" :query "tag:unread"))
\r
125 > @@ -101,12 +102,19 @@ (defcustom notmuch-saved-searches '((:name "inbox" =
\r
126 :query "tag:inbox")
\r
128 > :name Name of the search (required).
\r
129 > :query Search to run (required).
\r
130 > - :count-query Optional extra query to generate the count
\r
131 > - shown. If not present then the :query property
\r
133 > :sort-order Specify the sort order to be used for the search.
\r
134 > Possible values are 'oldest-first 'newest-first or
\r
135 > nil. Nil means use the default sort order.
\r
136 > + :display-function Optional function to generate the count and
\r
137 > + name to be displayed. The function takes a
\r
138 > + keyword list of arguments (it should use
\r
139 > + &rest). Keywords include :current for the
\r
140 > + current saved search plist and :options. If
\r
141 > + this function is not set then the default
\r
142 > + display of message count and name is used. The
\r
143 > + function should return an updated saved search
\r
144 > + plist including :name and :count as the name
\r
145 > + and count-string to be displayed.
\r
147 > Other accepted forms are a cons cell of the form (NAME . QUERY)
\r
148 > or a list of the form (NAME QUERY COUNT-QUERY)."
\r
149 > @@ -507,15 +515,16 @@ (defun notmuch-hello-query-counts (query-list &rest=
\r
151 > `notmuch-hello-insert-searches'."
\r
152 > (with-temp-buffer
\r
153 > (dolist (elem query-list nil)
\r
154 > - (let ((count-query (or (notmuch-saved-search-get elem :count-query)
\r
155 > - (notmuch-saved-search-get elem :query))))
\r
157 > - (replace-regexp-in-string
\r
159 > - (notmuch-hello-filtered-query count-query
\r
160 > - (or (plist-get options :filter-count)
\r
161 > - (plist-get options :filter))))
\r
163 > + (unless (notmuch-saved-search-get elem :display-function)
\r
164 > + (let ((count-query (or (notmuch-saved-search-get elem :count-query)
\r
165 > + (notmuch-saved-search-get elem :query))))
\r
167 > + (replace-regexp-in-string
\r
169 > + (notmuch-hello-filtered-query count-query
\r
170 > + (or (plist-get options :filter-count)
\r
171 > + (plist-get options :filter))))
\r
174 > (unless (=3D (call-process-region (point-min) (point-max) notmuch-co=
\r
176 > t t nil "count" "--batch") 0)
\r
177 > @@ -530,8 +539,14 @@ (defun notmuch-hello-query-counts (query-list &rest =
\r
182 > - (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem)))
\r
183 > - (notmuch-hello-batch-message-count elem-plist options)))
\r
184 > + (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem))
\r
185 > + (display-function (plist-get elem-plist :display-function))
\r
186 > + (result (if display-function
\r
187 > + (funcall display-function
\r
188 > + :current elem-plist
\r
189 > + :option options)
\r
190 > + (notmuch-hello-batch-message-count elem-plist
\r
193 If `notmuch-hello-batch-message-count' were re-written to operate as a
\r
194 display-function, this could be replaced with something like:
\r
196 (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem))
\r
197 (result (funcall (or (plist-get elem-plist :display-function)
\r
198 #'notmuch-hello-batch-message-count)
\r
199 :current elem-plist
\r
205 > (defun notmuch-hello-insert-buttons (searches)
\r
209 > _______________________________________________
\r
210 > notmuch mailing list
\r
211 > notmuch@notmuchmail.org
\r
212 > http://notmuchmail.org/mailman/listinfo/notmuch
\r
215 Content-Type: application/pgp-signature; name="signature.asc"
\r
217 -----BEGIN PGP SIGNATURE-----
\r
220 iKYEARECAGYFAlNw1L1fFIAAAAAALgAoaXNzdWVyLWZwckBub3RhdGlvbnMub3Bl
\r
221 bnBncC5maWZ0aGhvcnNlbWFuLm5ldDc1M0Y5NDJDMEExNjc3MDE4OURGMUYyMDY5
\r
222 RUNEMEFCRjA0OTY1MTYACgkQaezQq/BJZRYN3wCfbDQh4uxCmKiAgavy2XvYt9pJ
\r
223 LboAnjdqXDENPxF5/9CcUNhczpVCZLP9
\r
225 -----END PGP SIGNATURE-----
\r