[PATCH 2/5] cli: Extend the search command for --output=addresses and similar
[notmuch-archives.git] / 53 / 8083a1ce4b5dfcc8049ab747b9bf85ead8e25d
1 Return-Path: <daniel@schoepe.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 06714429E25\r
6         for <notmuch@notmuchmail.org>; Sat, 29 Oct 2011 10:25:34 -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.79\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.79 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         RCVD_IN_DNSWL_LOW=-0.7, T_MIME_NO_TEXT=0.01] 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 Lszy1NvVf10e for <notmuch@notmuchmail.org>;\r
17         Sat, 29 Oct 2011 10:25:33 -0700 (PDT)\r
18 Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com\r
19         [209.85.161.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 D83C5431FB6\r
22         for <notmuch@notmuchmail.org>; Sat, 29 Oct 2011 10:25:32 -0700 (PDT)\r
23 Received: by faai28 with SMTP id i28so5019762faa.26\r
24         for <notmuch@notmuchmail.org>; Sat, 29 Oct 2011 10:25:31 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=schoepe.org; s=google;\r
26         h=from:to:cc:subject:in-reply-to:references:user-agent:date\r
27         :message-id:mime-version:content-type;\r
28         bh=O4533N/9SL0iaUEXnS+v2bpt3c/nBXZtxdrI9WXS/ao=;\r
29         b=fVpleH2h7tXoojxbzpUk8O80p1V0FXM9lPzZBfiVHAkwqU29u2Hf9h9715OkWT1jxO\r
30         VGgl0wlNIJtpBBt84/wQKeokvHPaQbaCMwuZkxsd6H3qQToeuqwTjYX+F9GNkmBRhk6A\r
31         q1ORC0vK/hJkln5wuiA4Ljmze15f0usjZfh+Y=\r
32 Received: by 10.223.36.193 with SMTP id u1mr15059283fad.27.1319909131412;\r
33         Sat, 29 Oct 2011 10:25:31 -0700 (PDT)\r
34 Received: from localhost (dslb-178-004-066-018.pools.arcor-ip.net.\r
35         [178.4.66.18])\r
36         by mx.google.com with ESMTPS id w7sm25529596fab.6.2011.10.29.10.25.29\r
37         (version=TLSv1/SSLv3 cipher=OTHER);\r
38         Sat, 29 Oct 2011 10:25:29 -0700 (PDT)\r
39 From: Daniel Schoepe <daniel@schoepe.org>\r
40 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
41 Subject: Re: [RFC PATCH 3/3] emacs: support limiting the number of messages\r
42         shown in search results\r
43 In-Reply-To:\r
44  <0290050284e4cb3a6f5ef0eb3582319f8d52ccf2.1319833617.git.jani@nikula.org>\r
45 References: <cover.1319833617.git.jani@nikula.org>\r
46         <0290050284e4cb3a6f5ef0eb3582319f8d52ccf2.1319833617.git.jani@nikula.org>\r
47 User-Agent: Notmuch/0.9+47~g3dfd481 (http://notmuchmail.org) Emacs/23.3.1\r
48         (x86_64-pc-linux-gnu)\r
49 Date: Sat, 29 Oct 2011 19:25:22 +0200\r
50 Message-ID: <87pqhfk8vx.fsf@gilead.invalid>\r
51 MIME-Version: 1.0\r
52 Content-Type: multipart/signed; boundary="=-=-=";\r
53         micalg=pgp-sha1; protocol="application/pgp-signature"\r
54 Cc: amdragon@mit.edu\r
55 X-BeenThere: notmuch@notmuchmail.org\r
56 X-Mailman-Version: 2.1.13\r
57 Precedence: list\r
58 List-Id: "Use and development of the notmuch mail system."\r
59         <notmuch.notmuchmail.org>\r
60 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
62 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
63 List-Post: <mailto:notmuch@notmuchmail.org>\r
64 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
65 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
67 X-List-Received-Date: Sat, 29 Oct 2011 17:25:34 -0000\r
68 \r
69 --=-=-=\r
70 Content-Transfer-Encoding: quoted-printable\r
71 \r
72 On Fri, 28 Oct 2011 23:59:31 +0300, Jani Nikula <jani@nikula.org> wrote:\r
73 > Add support for limiting the maximum number of messages initially display=\r
74 ed\r
75 > in search results. When enabled, the search results will contain push\r
76 > buttons to double the number of messages displayed or to show unlimited\r
77 > messages.\r
78 \r
79 Nice patch, as it not only makes searches with a lot of results easier\r
80 to use on slower machines/hard drives, but I also find that seeing only\r
81 a few dozen threads in the buffer looks more "orderly" to me, compared\r
82 to a buffer with hundreds of lines.\r
83 \r
84 A few comments about the code:\r
85 \r
86 > @@ -373,6 +381,7 @@ Complete list of currently available key bindings:\r
87 >    (make-local-variable 'notmuch-search-oldest-first)\r
88 >    (make-local-variable 'notmuch-search-target-thread)\r
89 >    (make-local-variable 'notmuch-search-target-line)\r
90 > +  (make-local-variable 'notmuch-search-maxitems)\r
91 >    (set (make-local-variable 'notmuch-search-continuation) nil)\r
92 >    (set (make-local-variable 'scroll-preserve-screen-position) t)\r
93 >    (add-to-invisibility-spec 'notmuch-search)\r
94 > @@ -633,6 +642,8 @@ This function advances the next thread when finished."\r
95 >                       (insert "End of search results.")\r
96 >                       (if (not (=3D exit-status 0))\r
97 >                           (insert (format " (process returned %d)" exit-status)))\r
98 > +                     (if notmuch-search-maxitems\r
99 > +                         (notmuch-search-setup-buttons))\r
100 \r
101 As discussed on IRC, this causes `notmuch-search' to fail if the\r
102 maxitems argument is nil.\r
103 \r
104 > +(defun notmuch-search-setup-buttons ()\r
105 > +  (widget-insert "    ")\r
106 > +  (widget-create 'push-button\r
107 > +              :notify (lambda (&rest ignore)\r
108 > +                        (set 'notmuch-search-maxitems\r
109 > +                             (* 2 notmuch-search-maxitems))\r
110 > +                        (notmuch-search-refresh-view))\r
111 > +              :help-echo "Double the number of messages shown"\r
112 > +              "Show 2X messages")\r
113 > +  (widget-insert "    ")\r
114 > +  (widget-create 'push-button\r
115 > +              :notify (lambda (&rest ignore)\r
116 > +                        (set 'notmuch-search-maxitems 0)\r
117 > +                        (notmuch-search-refresh-view))\r
118 > +              :help-echo "Show all search results"\r
119 > +              "Show unlimited messages")\r
120 > +  (widget-setup))\r
121 \r
122 I think these notify-actions should be separate functions to make it\r
123 easier to bind them to keys.\r
124 \r
125 > +\r
126 >  (defcustom notmuch-poll-script ""\r
127 >    "An external script to incorporate new mail into the notmuch database.\r
128 >=20=20\r
129 > @@ -997,7 +1030,7 @@ current search results AND the additional query stri=\r
130 ng provided."\r
131 >                        query)))\r
132 >      (notmuch-search (if (string=3D notmuch-search-query-string "*")\r
133 >                       grouped-query\r
134 > -                   (concat notmuch-search-query-string " and " grouped-query)) notm=\r
135 uch-search-oldest-first)))\r
136 > +                   (concat notmuch-search-query-string " and "\r
137 >                        grouped-query)) notmuch-search-oldest-first\r
138 >                        notmuch-search-maxitems)))\r
139 \r
140 This causes notmuch-search-filter to fail (repeatedly), since `notmuch-sear=\r
141 ch'\r
142 expects a TARGET-THREAD (or nil) as its third parameter, but is given\r
143 `notmuch-search-maxitems' instead.\r
144 \r
145 >=20=20\r
146 >  (defun notmuch-search-filter-by-tag (tag)\r
147 >    "Filter the current search results based on a single tag.\r
148 > @@ -1006,7 +1039,7 @@ Runs a new search matching only messages that match=\r
149  both the\r
150 >  current search results AND that are tagged with the given tag."\r
151 >    (interactive\r
152 >     (list (notmuch-select-tag-with-completion "Filter by tag: ")))\r
153 > -  (notmuch-search (concat notmuch-search-query-string " and tag:" tag) n=\r
154 otmuch-search-oldest-first))\r
155 > +  (notmuch-search (concat notmuch-search-query-string " and tag:"\r
156 >    tag) notmuch-search-oldest-first notmuch-search-maxitems))\r
157 \r
158 Same here.\r
159 \r
160 Cheers,\r
161 Daniel\r
162 \r
163 --=-=-=\r
164 Content-Type: application/pgp-signature\r
165 \r
166 -----BEGIN PGP SIGNATURE-----\r
167 Version: GnuPG v1.4.11 (GNU/Linux)\r
168 \r
169 iQIcBAEBAgAGBQJOrDcCAAoJEIaTAtce+Z+JnfMP/irov7ZyMI/lt+hMa90hdgQt\r
170 4Hfbn5B985VxY7Gj60rj2CCi+KlkWTzRHrq06HhJtL3rTXuCEFwJuIrqPUSxH7nS\r
171 M3pcstubJ5QbXFwvYAJyR7QgELebdrIKwtls9VwSSx3xpEcT1MqybZMGL8BZmJmu\r
172 ZR2gJCQqp/CXB5DXOiULOEBbzEawO83RaKI6hKHj4e1U/QFy0J1sn+ImfYlmraz6\r
173 fKxFM7N31Oeh6K9P78oqdM3QLF0t5EnOrK9ZkYCOBUKu9HcvjTNbiNdR7ndRMgVX\r
174 +m+egx0Oz3FbFAaBXeVTY2Q4ldyY6sVGfJp3jOmymuftxtMhTDBaffkOn2PGv5a4\r
175 +gWPKDmJgopw5YYRaiN+de+GC7b7cE+5xmtsrAOEXh3oiExKH8Yb5irahyW351b6\r
176 OWi1O6trSEfga6bdTepWrPIHGiPvwWP0Hlih/pj4i3hS3m3vnf43wmJs7eu7obo7\r
177 QFnbhyT5LO2aE1Wz5LHt8S8wSm/H8n26gAlExj31h0ppiu779QriFJKFjYsKewwF\r
178 gsMqXIz9Rhj3zevEtOtDtjM2DdYOJOr4HEKjxEbe2/CKlczG68XAwoQ3teTXne+q\r
179 sUUoCQx/8MXqBEo7iHwq9SsYu2xk7Qi5l1Ya/wGM2xlsnoEJNRWSyrbKuw9G75C6\r
180 Mm10VNwBdmNI6Slo/XTA\r
181 =c4QO\r
182 -----END PGP SIGNATURE-----\r
183 --=-=-=--\r