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 0FBCE429E29
\r
6 for <notmuch@notmuchmail.org>; Sat, 4 Jun 2011 13:39:45 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 3h3geMVyq2sJ for <notmuch@notmuchmail.org>;
\r
17 Sat, 4 Jun 2011 13:39:44 -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 12BE5431FB6
\r
22 for <notmuch@notmuchmail.org>; Sat, 4 Jun 2011 13:39:43 -0700 (PDT)
\r
23 Received: by bwg12 with SMTP id 12so2787392bwg.26
\r
24 for <notmuch@notmuchmail.org>; Sat, 04 Jun 2011 13:39:42 -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=hsaPVvihgqV45JFWCwmf+pCH0w7iPwSkjicEiy0riiA=;
\r
30 b=rOisKwVHmj7XoaY9rJEEtzPyOsKVCL+pt1v2jKcgzXxr1zL57ErizwyfX5nIfTRnVr
\r
31 jt+WbftIwRfS9nLacWpZmFobZLMczRQjzCiVPqK/19SttuLoYeSpC85CvAaH3lDuq+TD
\r
32 ojwBwghMUrGwOzUHb8RsdfPdIN5UHo/ZEOXGY=
\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=UNzJDXE6wVf5paV6lccOonnB1ecNM7OZp7AbOTJddYPf3nSBhJXsYdqqKVaCCyajbn
\r
37 Gb5HQNBnHn+5yNGBZYaNq0ZcB5amzcLUoiEBjDqqUqdzU3hfo/JrdKvf4+OWF6XjEr5t
\r
38 brOUFdlniSDUfWCeOZTI3fHQDKmPDaIxobrVc=
\r
39 Received: by 10.204.84.217 with SMTP id k25mr570718bkl.54.1307219982588;
\r
40 Sat, 04 Jun 2011 13:39:42 -0700 (PDT)
\r
41 Received: from localhost (dslb-088-069-155-133.pools.arcor-ip.net
\r
43 by mx.google.com with ESMTPS id g2sm2172032bkz.23.2011.06.04.13.39.40
\r
44 (version=TLSv1/SSLv3 cipher=OTHER);
\r
45 Sat, 04 Jun 2011 13:39:41 -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: <87mxhxjrry.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>
\r
54 User-Agent: Notmuch/0.5-217-gd1f0224 (http://notmuchmail.org) Emacs/23.3.1
\r
55 (x86_64-pc-linux-gnu)
\r
56 Date: Sat, 04 Jun 2011 22:39:32 +0200
\r
57 Message-ID: <87k4d1jpq3.fsf@gilead.invalid>
\r
59 Content-Type: multipart/signed; boundary="==-=-=";
\r
60 micalg=pgp-sha1; protocol="application/pgp-signature"
\r
61 Cc: notmuch@notmuchmail.org
\r
62 X-BeenThere: notmuch@notmuchmail.org
\r
63 X-Mailman-Version: 2.1.13
\r
65 List-Id: "Use and development of the notmuch mail system."
\r
66 <notmuch.notmuchmail.org>
\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
70 List-Post: <mailto:notmuch@notmuchmail.org>
\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
74 X-List-Received-Date: Sat, 04 Jun 2011 20:39:45 -0000
\r
77 Content-Type: multipart/mixed; boundary="=-=-="
\r
80 Content-Type: text/plain
\r
82 Sorry, forgot to actually test notmuch-search entirely with this change
\r
83 and not just the completion.
\r
86 Content-Type: text/x-diff
\r
87 Content-Disposition: inline;
\r
88 filename=0001-emacs-Tab-completion-for-notmuch-search-and-notmuch-.patch
\r
89 Content-Transfer-Encoding: quoted-printable
\r
91 From=20cb172efc1dea2507566db587f960c073373e0159 Mon Sep 17 00:00:00 2001
\r
92 From: Daniel Schoepe <daniel.schoepe@googlemail.com>
\r
93 Date: Sat, 4 Jun 2011 14:17:44 +0200
\r
94 Subject: [PATCH] emacs: Tab completion for notmuch-search and
\r
95 notmuch-search-filter
\r
97 This patch adds completion with <tab> in the minibuffer for
\r
98 notmuch-search and notmuch-search-filter.
\r
100 emacs/notmuch.el | 35 +++++++++++++++++++++++++++++++++--
\r
101 1 files changed, 33 insertions(+), 2 deletions(-)
\r
103 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
104 index 3311fe8..a2db852 100644
\r
105 =2D-- a/emacs/notmuch.el
\r
106 +++ b/emacs/notmuch.el
\r
107 @@ -72,6 +72,9 @@ For example:
\r
108 :type '(alist :key-type (string) :value-type (string))
\r
111 +(defvar notmuch-completions nil
\r
112 + "List of completions used in notmuch-query-completions")
\r
114 (defun notmuch-select-tag-with-completion (prompt &rest search-terms)
\r
116 (with-output-to-string
\r
117 @@ -882,6 +885,34 @@ characters as well as `_.+-'.
\r
118 (concat "*notmuch-search-" query "*"))
\r
121 +(defun notmuch-query-completions (string)
\r
122 + "Return possible completions for STRING."
\r
124 + ;; this ugly regexp is used to get the last word of the input
\r
125 + ;; possibly preceded by a '('
\r
126 + ((string-match "\\(^\\|.* (?\\)\\([^ ]*\\)$" string)
\r
127 + (mapcar (lambda (compl)
\r
128 + (concat (match-string-no-properties 1 string) compl))
\r
129 + (all-completions (match-string-no-properties 2 string)
\r
130 + notmuch-completions)))
\r
131 + (t (list string))))
\r
133 +(defun notmuch-read-query (prompt)
\r
134 + "Read a notmuch-query from the minibuffer with completion.
\r
136 +PROMPT is the string to prompt with."
\r
137 + (let ((keymap (copy-keymap minibuffer-local-map))
\r
138 + (minibuffer-completion-table (completion-table-dynamic #'notmuch-query-co=
\r
140 + ;; this was simpler than convincing completing-read to accept spaces:
\r
141 + (define-key keymap (kbd "<tab>") 'minibuffer-complete)
\r
142 + (setq notmuch-completions
\r
143 + (append (list "folder:" "thread:" "id:" "date:" "from:" "to:"
\r
144 + "subject:" "attachment:")
\r
145 + (mapcar (lambda (tag)
\r
146 + (concat "tag:" tag))
\r
147 + (process-lines "notmuch" "search-tags"))))
\r
148 + (read-from-minibuffer prompt nil keymap nil minibuffer-history nil nil=
\r
152 (defun notmuch-search (query &optional oldest-first target-thread target-l=
\r
154 "Run \"notmuch search\" with the given query string and display results.
\r
155 @@ -893,7 +924,7 @@ The optional parameters are used as follows:
\r
156 current if it appears in the search results.
\r
157 target-line: The line number to move to if the target thread does not
\r
158 appear in the search results."
\r
159 =2D (interactive "sNotmuch search: ")
\r
160 + (interactive (list (notmuch-read-query "Notmuch search: ")))
\r
161 (let ((buffer (get-buffer-create (notmuch-search-buffer-title query))))
\r
162 (switch-to-buffer buffer)
\r
163 (notmuch-search-mode)
\r
164 @@ -991,7 +1022,7 @@ search."
\r
166 Runs a new search matching only messages that match both the
\r
167 current search results AND the additional query string provided."
\r
168 =2D (interactive "sFilter search: ")
\r
169 + (interactive (list (notmuch-read-query "Filter search: ")))
\r
170 (let ((grouped-query (if (string-match-p notmuch-search-disjunctive-rege=
\r
172 (concat "( " query " )")
\r
181 Content-Type: application/pgp-signature
\r
183 -----BEGIN PGP SIGNATURE-----
\r
184 Version: GnuPG v1.4.11 (GNU/Linux)
\r
186 iQIcBAEBAgAGBQJN6pgEAAoJEIaTAtce+Z+JygUP/0JhM/g994Yz/4YnNvyqYLvf
\r
187 nL8ca0fB8bZUwZ3K2egJJbvf6M4mtOQ1k7bjwE1sZeEF3Sjmf/ePGZo1tgF3yElk
\r
188 mi52c5Jg+5FdQ4un0hZ/j1eed4OgvCkrt8+qsNjRh5Jfq3z4XjeKt7yoVnwrwWzm
\r
189 eV7jymvcYczSk0LMmAnaHj7bwTomFHgDkqIMstLZF5yiMqe8SCMqKu9IN6crLVtS
\r
190 8md4jI7myoTB69r5BUuV+cpISfVj6MCW1kbAzS2WEfs0+DlCbNksMbtSvQ/eG+z8
\r
191 NZ++WxLzG1fEejOYVtwuUfeNguLv25SvRZ7HQCVdrYed5TpNFkmCvn/O0olANTU2
\r
192 F2fTi/zN1uOUn0ldx4guoABBY98ZlHr+7oq3LzuOuYNmQ+vfcGk9LQmggmNWhQAG
\r
193 pR5xmiWB5yiAoXYgtqcexJlE2xs70IgbcMRQKUQGCPBbfgInHsFW8J2mulz3w7j5
\r
194 Gp33OEAn7PGNTf8o0G7Hb3kShVmo+sBr9pfv2WAr0l/nb/QLSOBOOorzF0YVBpZT
\r
195 HApFKNnw3ipp2bbBSQRjUklRL/1L1siW9ltqvPRMovrKinJNwfR3BpqNtUcVkRaT
\r
196 jKjLJvWZ3x4gxvjbgPBpu0AxV+2JtZaqGfLCgFt+He3g4FvQj9vjZm9ds3jzQqS7
\r
197 h+f+AtBk7sNgcZFn9vTe
\r
199 -----END PGP SIGNATURE-----
\r