1 Return-Path: <tomi.ollila@iki.fi>
\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 A3F72431FC2
\r
6 for <notmuch@notmuchmail.org>; Mon, 23 Feb 2015 23:20:40 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=2.438 tagged_above=-999 required=5
\r
12 tests=[DNS_FROM_AHBL_RHSBL=2.438] 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 5N5qeBWXL5Nz for <notmuch@notmuchmail.org>;
\r
16 Mon, 23 Feb 2015 23:20:37 -0800 (PST)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 52C70431FC0
\r
19 for <notmuch@notmuchmail.org>; Mon, 23 Feb 2015 23:20:37 -0800 (PST)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id 4F7D210019F
\r
22 for <notmuch@notmuchmail.org>; Tue, 24 Feb 2015 09:12:24 +0200 (EET)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: notmuch@notmuchmail.org
\r
25 Subject: Re: [PATCH 5/5] completion: complete addresses in from:/to: search
\r
27 In-Reply-To: <1422388098-16333-5-git-send-email-jani@nikula.org>
\r
28 References: <1422388098-16333-1-git-send-email-jani@nikula.org>
\r
29 <1422388098-16333-5-git-send-email-jani@nikula.org>
\r
30 User-Agent: Notmuch/0.19+53~gb45d2f9 (http://notmuchmail.org) Emacs/24.3.1
\r
31 (x86_64-unknown-linux-gnu)
\r
32 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
33 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
34 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
35 Date: Tue, 24 Feb 2015 09:12:24 +0200
\r
36 Message-ID: <m2fv9vhjfr.fsf@guru.guru-group.fi>
\r
38 Content-Type: text/plain
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Tue, 24 Feb 2015 07:20:40 -0000
\r
53 On Tue, Jan 27 2015, Jani Nikula <jani@nikula.org> wrote:
\r
55 > Use the new notmuch address command to do completion for addresses in
\r
60 > This patch is more of an RFC. The to: completion is sloooow because
\r
61 > typically there are more matches to begin with, and then producing the
\r
62 > results requires reading the messages. Maybe it would be better to use
\r
63 > the same mechanism as from: for both, even if it's not accurate for
\r
66 Shameless marketing puff: Imagine how fast would it would be to use
\r
67 nottoomuch-addresses -- the completions are there before one
\r
68 sees TAB KeyRelease event... ;)
\r
74 > completion/notmuch-completion.bash | 30 +++++++++++++++++++++++++-----
\r
75 > 1 file changed, 25 insertions(+), 5 deletions(-)
\r
77 > diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash
\r
78 > index e0498903f22f..db49294fc58c 100644
\r
79 > --- a/completion/notmuch-completion.bash
\r
80 > +++ b/completion/notmuch-completion.bash
\r
81 > @@ -27,10 +27,30 @@
\r
85 > -_notmuch_user_emails()
\r
86 > +# $1: current input of the form prefix:partialinput, where prefix is
\r
90 > - notmuch config get user.primary_email
\r
91 > - notmuch config get user.other_email
\r
92 > + local output prefix cur
\r
94 > + prefix="${1%%:*}"
\r
97 > + # Cut the input to be completed at punctuation because
\r
98 > + # (apparently) Xapian does not support the trailing wildcard '*'
\r
99 > + # operator for input with punctuation. We let compgen handle the
\r
100 > + # extra filtering required.
\r
101 > + cur="${cur%%[^a-zA-Z0-9]*}"
\r
103 > + case "$prefix" in
\r
104 > + to) output=recipients;;
\r
105 > + from) output=sender;;
\r
109 > + # Only emit plain, lower case, unique addresses.
\r
110 > + notmuch address --output=$output $prefix:"${cur}*" | \
\r
111 > + sed 's/[^<]*<\([^>]*\)>/\1/' | tr "[:upper:]" "[:lower:]" | sort -u
\r
114 > _notmuch_search_terms()
\r
115 > @@ -44,10 +64,10 @@ _notmuch_search_terms()
\r
116 > COMPREPLY=( $(compgen -P "tag:" -W "`notmuch search --output=tags \*`" -- ${cur##tag:}) )
\r
119 > - COMPREPLY=( $(compgen -P "to:" -W "`_notmuch_user_emails`" -- ${cur##to:}) )
\r
120 > + COMPREPLY=( $(compgen -P "to:" -W "`_notmuch_email ${cur}`" -- ${cur##to:}) )
\r
123 > - COMPREPLY=( $(compgen -P "from:" -W "`_notmuch_user_emails`" -- ${cur##from:}) )
\r
124 > + COMPREPLY=( $(compgen -P "from:" -W "`_notmuch_email ${cur}`" -- ${cur##from:}) )
\r
127 > local path=`notmuch config get database.path`
\r
131 > _______________________________________________
\r
132 > notmuch mailing list
\r
133 > notmuch@notmuchmail.org
\r
134 > http://notmuchmail.org/mailman/listinfo/notmuch
\r