[Alpha PATCH 1/6] util/hex-escape.[ch]: encoding/decoding strings into restricted...
[notmuch-archives.git] / 43 / d7fb181a1aea1d8e126bb14fd261fbe8497e83
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 A08FD429E25\r
6         for <notmuch@notmuchmail.org>; Mon,  6 Jun 2011 09:32:59 -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 fee5pmtjET5S for <notmuch@notmuchmail.org>;\r
17         Mon,  6 Jun 2011 09:32:59 -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 9CC00431FB6\r
22         for <notmuch@notmuchmail.org>; Mon,  6 Jun 2011 09:32:58 -0700 (PDT)\r
23 Received: by fxm8 with SMTP id 8so2839243fxm.26\r
24         for <notmuch@notmuchmail.org>; Mon, 06 Jun 2011 09:32:57 -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=nVrSXgo1Tmn4P0/mKDVZ/NHt448FeuaKVwyl3X/dEAE=;\r
30         b=ASMtjna5lHCfijPqdX4d+i2MkZCxv3Nd3TSX+PO2XNLvhzzLZ3DOnzXWdmXdnLix9o\r
31         9RKLplWcyfiNX/nBjxYE53evjsU8Y6sggMtJtjQkud70d0Y0VxWIY6DLLMfRVtXdXRUn\r
32         5OrJX03p908V656JUzJV/SCW4pLam+kFgc63g=\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=LRpgwoUp0d53JJncNSNvUBfXY+rPDSWr+4+ezKv08hg3XA2h/eoCZIBBtKw/z8YTNS\r
37         Vj0QTQwto0hvXSqBDmPpEizLZFsbFfYafwFCkojbNnDj3zimOfZ10nomNX7po8P+/MG9\r
38         UGRkPpl0EpkQCIt4SuyoIxDvSrTtIG6rzLSfc=\r
39 Received: by 10.223.25.201 with SMTP id a9mr1376430fac.141.1307377977094;\r
40         Mon, 06 Jun 2011 09:32:57 -0700 (PDT)\r
41 Received: from localhost (dslb-088-068-007-168.pools.arcor-ip.net\r
42         [88.68.7.168])\r
43         by mx.google.com with ESMTPS id 11sm1441026fax.36.2011.06.06.09.32.54\r
44         (version=TLSv1/SSLv3 cipher=OTHER);\r
45         Mon, 06 Jun 2011 09:32:55 -0700 (PDT)\r
46 From: Daniel Schoepe <daniel.schoepe@googlemail.com>\r
47 To: Austin Clements <amdragon@MIT.EDU>\r
48 Subject: Re: [PATCH] emacs: Tab completion for notmuch-search and\r
49         notmuch-search-filter\r
50 In-Reply-To: <87hb85jjgx.fsf@gilead.invalid>\r
51 References: <1307189970-728-1-git-send-email-daniel.schoepe@googlemail.com>\r
52         <BANLkTimudbqYy8JhGHu67WsOS04mCm0hfA@mail.gmail.com>\r
53         <87mxhxjrry.fsf@gilead.invalid> <20110604215523.GF29861@mit.edu>\r
54         <87hb85jjgx.fsf@gilead.invalid>\r
55 User-Agent: Notmuch/0.5-225-ga896936 (http://notmuchmail.org) Emacs/23.3.1\r
56         (x86_64-pc-linux-gnu)\r
57 Date: Mon, 06 Jun 2011 18:32:41 +0200\r
58 Message-ID: <87lixevs2e.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: Mon, 06 Jun 2011 16:32:59 -0000\r
76 \r
77 --==-=-=\r
78 Content-Type: multipart/mixed; boundary="=-=-="\r
79 \r
80 --=-=-=\r
81 \r
82 I accidentally left a, now unnecessary, defvar in the patch from one of\r
83 the previous attempts, here is the updated version (thanks Austin for\r
84 noticing).\r
85 \r
86 \r
87 --=-=-=\r
88 Content-Type: text/x-diff\r
89 Content-Disposition: inline;\r
90  filename=0001-emacs-Tab-completion-for-notmuch-search-and-notmuch-.patch\r
91 Content-Transfer-Encoding: quoted-printable\r
92 \r
93 From=20f3bc7376edc66e947d8fdf5931a9aa697b9be5cf Mon Sep 17 00:00:00 2001\r
94 From: Daniel Schoepe <daniel.schoepe@googlemail.com>\r
95 Date: Sat, 4 Jun 2011 14:17:44 +0200\r
96 Subject: [PATCH] emacs: Tab completion for notmuch-search and\r
97  notmuch-search-filter\r
98 \r
99 This patch adds completion with <tab> in the minibuffer for\r
100 notmuch-search and notmuch-search-filter.\r
101 =2D--\r
102  emacs/notmuch.el |   33 +++++++++++++++++++++++++++++++--\r
103  1 files changed, 31 insertions(+), 2 deletions(-)\r
104 \r
105 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
106 index 3311fe8..7ffbc3a 100644\r
107 =2D-- a/emacs/notmuch.el\r
108 +++ b/emacs/notmuch.el\r
109 @@ -882,6 +882,35 @@ characters as well as `_.+-'.\r
110            (concat "*notmuch-search-" query "*"))\r
111           )))\r
112 =20\r
113 +(defun notmuch-read-query (prompt)\r
114 +  "Read a notmuch-query from the minibuffer with completion.\r
115 +\r
116 +PROMPT is the string to prompt with."\r
117 +  (lexical-let\r
118 +      ((completions=20\r
119 +       (append (list "folder:" "thread:" "id:" "date:" "from:" "to:"\r
120 +                     "subject:" "attachment:")\r
121 +               (mapcar (lambda (tag)\r
122 +                         (concat "tag:" tag))\r
123 +                       (process-lines "notmuch" "search-tags")))))\r
124 +    (let ((keymap (copy-keymap minibuffer-local-map))\r
125 +         (minibuffer-completion-table\r
126 +          (completion-table-dynamic\r
127 +           (lambda (string)\r
128 +             ;; generate a list of possible completions for the current input\r
129 +             (cond\r
130 +              ;; this ugly regexp is used to get the last word of the input\r
131 +              ;; possibly preceded by a '('\r
132 +              ((string-match "\\(^\\|.* (?\\)\\([^ ]*\\)$" string)\r
133 +               (mapcar (lambda (compl)\r
134 +                         (concat (match-string-no-properties 1 string) compl))\r
135 +                       (all-completions (match-string-no-properties 2 string)\r
136 +                                        completions)))\r
137 +              (t (list string)))))))\r
138 +      ;; this was simpler than convincing completing-read to accept spaces:\r
139 +      (define-key keymap (kbd "<tab>") 'minibuffer-complete)\r
140 +      (read-from-minibuffer prompt nil keymap nil minibuffer-history nil n=\r
141 il))))\r
142 +\r
143  ;;;###autoload\r
144  (defun notmuch-search (query &optional oldest-first target-thread target-l=\r
145 ine continuation)\r
146    "Run \"notmuch search\" with the given query string and display results.\r
147 @@ -893,7 +922,7 @@ The optional parameters are used as follows:\r
148                   current if it appears in the search results.\r
149    target-line: The line number to move to if the target thread does not\r
150                 appear in the search results."\r
151 =2D  (interactive "sNotmuch search: ")\r
152 +  (interactive (list (notmuch-read-query "Notmuch search: ")))\r
153    (let ((buffer (get-buffer-create (notmuch-search-buffer-title query))))\r
154      (switch-to-buffer buffer)\r
155      (notmuch-search-mode)\r
156 @@ -991,7 +1020,7 @@ search."\r
157 =20\r
158  Runs a new search matching only messages that match both the\r
159  current search results AND the additional query string provided."\r
160 =2D  (interactive "sFilter search: ")\r
161 +  (interactive (list (notmuch-read-query "Filter search: ")))\r
162    (let ((grouped-query (if (string-match-p notmuch-search-disjunctive-rege=\r
163 xp query)\r
164                            (concat "( " query " )")\r
165                          query)))\r
166 =2D-=20\r
167 1.7.5.3\r
168 \r
169 \r
170 --=-=-=--\r
171 \r
172 --==-=-=\r
173 Content-Type: application/pgp-signature\r
174 \r
175 -----BEGIN PGP SIGNATURE-----\r
176 Version: GnuPG v1.4.11 (GNU/Linux)\r
177 \r
178 iQIcBAEBAgAGBQJN7QEpAAoJEIaTAtce+Z+JkAIP/ilrKOti8iwVo/u1A0CtX2R+\r
179 cVF4NAGzsWoK0KsYTNFPV3dtssmJXemMPPtBbXI+W+Q6axPUXsSbV1XY/f/3yRlw\r
180 sS0hUmqGbmUZiBKzVaNJ/bH2nDZkBbEqsUMTaMfKYr7UbnnPYXCS82FFr2zDRlBQ\r
181 bOBokkBMvmaIKLDXJuuRbtkZc3/5M61nWKqO7SBVySjgkflDIgItiLbNdimu7M47\r
182 Fj/N7yyDww+YcQVynqj0EiOVZRzJ4g4o5BGhx8fcpNk6MUH/IeokwP2pp1/NhMWB\r
183 iWi1qj3c/V0d4XEibMXyAc+8mpVaB+izWopRIx5+KdRAp/CJR+qvSgWBwJEtvbeY\r
184 RvBFh0+GF3skontDhuiHnu3IX1625QRHPxrvm+wZaOWC8p5vdPOtGO7hvWTvVKYQ\r
185 ykmljx/JrBoWUBG/rN21BGq1f739dMsuLJ2MLw0w8ZFU0OXQr9AhQnb+8RSpNIJE\r
186 brCM+cpvpVzwpvhmI0T5/VeqORSuunO11pvj3543xuLU36sfI5atxR1pz7cZBE2x\r
187 qoHzmq2kI+HMMfNb2bM5m0VQslcGURrO3ZIDWORSzjhChiw1EhC5vyL8YRtVDRxQ\r
188 /ED/NSaXu3O507owBh4uFIdq4CbNhkCxIdtFC+hjQGu53HObSyx5N0rn9FikHILG\r
189 tM+b8pzAaAH/s3kWxM3i\r
190 =JRlC\r
191 -----END PGP SIGNATURE-----\r
192 --==-=-=--\r