[PATCH 1/5] emacs: compile and load notmuch-pick.el if present.
[notmuch-archives.git] / 2f / 5dfd2f87f7d5f1c663ee32da881e793e70d003
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 ACE68429E28\r
6         for <notmuch@notmuchmail.org>; Wed, 25 May 2011 09:51:14 -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.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 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] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id 7IJQ-WVXL3hR for <notmuch@notmuchmail.org>;\r
17         Wed, 25 May 2011 09:51:13 -0700 (PDT)\r
18 Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com\r
19         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id E3481431FB6\r
22         for <notmuch@notmuchmail.org>; Wed, 25 May 2011 09:51:12 -0700 (PDT)\r
23 Received: by bwg12 with SMTP id 12so7256765bwg.26\r
24         for <notmuch@notmuchmail.org>; Wed, 25 May 2011 09:51:11 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26         d=googlemail.com; s=gamma;\r
27         h=domainkey-signature:from:to:cc:subject:in-reply-to:references\r
28         :user-agent:date:message-id:mime-version:content-type;\r
29         bh=s3bJ3j54dspbM5R/BkWfdKxckL5F8i9+5EtkU5duXTs=;\r
30         b=Jh1sVfyD70aOXUA7sCyRinLnjbFV7lqh7w8p0OUB0V/IdkXR0X6nVuCZipXNDsEoDd\r
31         zfPh++8AH7HzVvV184FJLwCp6oPNct/0viHZkbHo4Ni9LZtoEItKSsJz6OPeT9HuCzU0\r
32         7K/KLU6lJNDUat1fPNUMIFu/Kg/4oVfa3ZBSo=\r
33 DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma;\r
34         h=from:to:cc:subject:in-reply-to:references:user-agent:date\r
35         :message-id:mime-version:content-type;\r
36         b=ivbOBdJ9g9YtCE/Cy/PShKiwpsIGOGdOsPkJlZTnloVWARujffEgG3j0ZPw1F8VzaK\r
37         maa4wym8fI9bIaSYhQpAx+8MtbWhA6w8gp8VKPG/w269ccCOpr7nBvAPTKjJXfLAMPjT\r
38         6OsXZzihciTJlRhki8Gnj8O+5g2rLgZ28U9Tw=\r
39 Received: by 10.204.80.28 with SMTP id r28mr1232375bkk.46.1306342271286;\r
40         Wed, 25 May 2011 09:51:11 -0700 (PDT)\r
41 Received: from localhost (dslb-178-004-026-109.pools.arcor-ip.net\r
42         [178.4.26.109])\r
43         by mx.google.com with ESMTPS id x6sm5337313bkv.0.2011.05.25.09.51.08\r
44         (version=TLSv1/SSLv3 cipher=OTHER);\r
45         Wed, 25 May 2011 09:51:09 -0700 (PDT)\r
46 From: Daniel Schoepe <daniel.schoepe@googlemail.com>\r
47 To: Austin Clements <amdragon@mit.edu>,\r
48     Carl Worth <cworth@cworth.org>\r
49 Subject: Re: [PATCH] emacs: Make the queries used in the all-tags section\r
50 In-Reply-To: <BANLkTin0+O=mubHF7JNpw4u3DQDQJQ5zbw@mail.gmail.com>\r
51 References: <87fwoath2s.fsf@gilead.home.box>\r
52         <BANLkTinKS5LbQsZuK8HyCzj+Lo4xqa2Sfg@mail.gmail.com>\r
53         <871uznqeox.fsf@tredergarh.home.box>\r
54         <BANLkTin0+O=mubHF7JNpw4u3DQDQJQ5zbw@mail.gmail.com>\r
55 User-Agent: Notmuch/0.5-210-g1acc997 (http://notmuchmail.org) Emacs/23.3.1\r
56         (x86_64-pc-linux-gnu)\r
57 Date: Wed, 25 May 2011 18:51:02 +0200\r
58 Message-ID: <874o4iwwp5.fsf@gilead.invalid>\r
59 MIME-Version: 1.0\r
60 Content-Type: multipart/signed; boundary="==-=-=";\r
61         micalg=pgp-sha1; protocol="application/pgp-signature"\r
62 Cc: notmuch@notmuchmail.org\r
63 X-BeenThere: notmuch@notmuchmail.org\r
64 X-Mailman-Version: 2.1.13\r
65 Precedence: list\r
66 List-Id: "Use and development of the notmuch mail system."\r
67         <notmuch.notmuchmail.org>\r
68 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
70 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
71 List-Post: <mailto:notmuch@notmuchmail.org>\r
72 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
73 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
74         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
75 X-List-Received-Date: Wed, 25 May 2011 16:51:14 -0000\r
76 \r
77 --==-=-=\r
78 Content-Type: multipart/mixed; boundary="=-=-="\r
79 \r
80 --=-=-=\r
81 Content-Type: text/plain\r
82 \r
83 On Wed, 25 May 2011 10:44:51 -0400, Austin Clements <amdragon@mit.edu> wrote:\r
84 > May I suggest a slightly different way of looking at this that will\r
85 > quell my inner parser?  Instead of configuring a weird "query\r
86 > fragment" like "and tag:unread" to be string-concatenated with the tag\r
87 > query, configure a *filter* query like merely "tag:unread" that\r
88 > narrows down what you'd like to be counted within the scope of a tag.\r
89 > The implementations are hardly different---simply generate the query\r
90 > "tag:<tag> and ( <filter> )"---but a filter is a well-formed query,\r
91 > not some string fragment.  Furthermore, the user can't get bitten by\r
92 > precedence and wind up with a query that counts messages that don't\r
93 > even have that tag.\r
94 \r
95 Good point, I attached an updated patch that implements this.\r
96 \r
97 --=-=-=\r
98 Content-Type: text/x-diff\r
99 Content-Disposition: inline;\r
100  filename=0001-emacs-Make-queries-used-in-the-all-tags-section-conf.patch\r
101 Content-Transfer-Encoding: quoted-printable\r
102 \r
103 From=206a4a5fd3e2a1baa25f86f85d6c3324db26582b82 Mon Sep 17 00:00:00 2001\r
104 From: Daniel Schoepe <daniel.schoepe@googlemail.com>\r
105 Date: Fri, 20 May 2011 00:53:50 +0200\r
106 Subject: [PATCH] emacs: Make queries used in the all-tags section\r
107  configurable\r
108 \r
109 This patch adds a customization variable that controls what queries\r
110 are used to construct the all-tags section in notmuch-hello. It allows\r
111 the user to specify a function to construct the query given a tag or\r
112 a string that is used as a filter for each tag.\r
113 It also adds a variable to hide various tags from the all-tags section.\r
114 \r
115 Signed-off-by: Daniel Schoepe <daniel.schoepe@googlemail.com>\r
116 =2D--\r
117  emacs/notmuch-hello.el |   37 ++++++++++++++++++++++++++++++++++---\r
118  1 files changed, 34 insertions(+), 3 deletions(-)\r
119 \r
120 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
121 index e58dd24..a513bb0 100644\r
122 =2D-- a/emacs/notmuch-hello.el\r
123 +++ b/emacs/notmuch-hello.el\r
124 @@ -55,6 +55,24 @@\r
125    :type 'boolean\r
126    :group 'notmuch)\r
127 =20\r
128 +(defcustom notmuch-hello-tag-list-make-query nil\r
129 +  "Function or string to generate queries for the all tags list.\r
130 +\r
131 +This variable controls which query results are shown for each tag\r
132 +in the \"all tags\" list. It can be nil (for default behaviour,\r
133 +displaying all messages for a tag), a string that is used as a\r
134 +filter for messages having that tag (equivalent to \"tag:TAG\r
135 +and (THIS-VARIABLE)\", or a function that is given a tag and\r
136 +should return the query that is to be used for the tag. If it\r
137 +returns nil, the corresponding tag will be hidden."\r
138 +  :type '(choice (const nil :tag "tag:TAG") string function)\r
139 +  :group 'notmuch)\r
140 +\r
141 +(defcustom notmuch-hello-hide-tags nil\r
142 +  "List of tags to be hidden in the \"all tags\"-section."\r
143 +  :type '(repeat string)\r
144 +  :group 'notmuch)\r
145 +\r
146  (defface notmuch-hello-logo-background\r
147    '((((class color)\r
148        (background dark))\r
149 @@ -318,6 +336,21 @@ Complete list of currently available key bindings:\r
150   ;;(setq buffer-read-only t)\r
151  )\r
152 =20\r
153 +(defun notmuch-hello-generate-tag-alist ()\r
154 +  "Return an alist from tags to queries to display in the all-tags section=\r
155 ."\r
156 +  (filter 'cdr\r
157 +         (mapcar '(lambda (tag)\r
158 +                    (cons tag\r
159 +                          (cond\r
160 +                           ((functionp notmuch-hello-tag-list-make-query)\r
161 +                            (funcall notmuch-hello-tag-list-make-query tag))\r
162 +                           ((stringp notmuch-hello-tag-list-make-query)\r
163 +                            (concat "tag:" tag " and ("\r
164 +                                    notmuch-hello-tag-list-make-query ")"))\r
165 +                           (t (concat "tag:" tag)))))\r
166 +                 (filter (lambda (tag) (not (member tag notmuch-hello-hide-tags)))\r
167 +                         (process-lines notmuch-command "search-tags")))))\r
168 +\r
169  ;;;###autoload\r
170  (defun notmuch-hello (&optional no-display)\r
171    "Run notmuch and display saved searches, known tags, etc."\r
172 @@ -396,9 +429,7 @@ Complete list of currently available key bindings:\r
173                       if (> (string-to-number (notmuch-saved-search-count (cdr elem))) 0)\r
174                       collect elem)))\r
175              (saved-widest (notmuch-hello-longest-label saved-alist))\r
176 =2D          (alltags-alist (if notmuch-show-all-tags-list\r
177 =2D                             (mapcar '(lambda (tag) (cons tag (concat "tag:" tag)))\r
178 =2D                                     (process-lines notmuch-command "search-tags"))))\r
179 +            (alltags-alist (if notmuch-show-all-tags-list (notmuch-hello-generat=\r
180 e-tag-alist)))\r
181              (alltags-widest (notmuch-hello-longest-label alltags-alist))\r
182              (widest (max saved-widest alltags-widest)))\r
183 =20\r
184 =2D-=20\r
185 1.7.5.1\r
186 \r
187 \r
188 --=-=-=--\r
189 \r
190 --==-=-=\r
191 Content-Type: application/pgp-signature\r
192 \r
193 -----BEGIN PGP SIGNATURE-----\r
194 Version: GnuPG v1.4.11 (GNU/Linux)\r
195 \r
196 iQIcBAEBAgAGBQJN3TN2AAoJEIaTAtce+Z+JlxEQAKKqJoo2qjao/rxGiRPng9sL\r
197 6l4nV4bYozWDYNnhyz5lPT4MY+YF9H2cR8aDLodfc27Ktc3cEWolzA1IKG7ntu5r\r
198 zH6LjQOip9PNW/i46STZQNEql4B7tXI9ZUoOD349s2233xYrA+W9TqAL0n2XfOqM\r
199 cwN6WiHKkY7DrysvHJBNILaUwmKDy9ay09QtrCupfRCo9DM2HK60vKPmb0H21P6x\r
200 ekZ/aNuAwPifEuYJygPnrKAo5jL3TSh13A+0NlRC7SoHxE/Cc/7eLU6tDhaFgZFP\r
201 v54aX6x4A2zLkeBoLrsutMh6ND/dOljkuW4m51a4PqOtpLUQm8EXKQYgwJE3OuIR\r
202 xEtHBaim6TjwZCYwmlw9FTMPC8dL4kCfFpUmHXTKYi/1MpNKC7ppUH256hmqOgEp\r
203 7QhNrDjPWWanvdyAnzoV9+7ezDFlYFde2GjULalSLTlVjPR0GwbJnCmlS+nbZnMJ\r
204 oKZ5pDIsEuO+HZP2v0hUv5asBfOBRKBzbbXqeiX8MjypB4Qv5AxYAxnRKY9JczLu\r
205 gcEmH9i5VtIy6EIBoDNigajbXYfwgSfbJxvdohS/PrsAfEtLZS1rcZ2QoeygblPq\r
206 2bJyuo7tzoKabj7Cjbourk4EQ/d5/oKCG5a3OQaDZjthgMNXQ5cGuSoNZbQrzRyB\r
207 Q2A9DM3r7uI9HJlq4bhZ\r
208 =LRkh\r
209 -----END PGP SIGNATURE-----\r
210 --==-=-=--\r