From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 92E3D6DE0BB9 for ; Mon, 17 Sep 2018 05:01:48 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.002 X-Spam-Level: X-Spam-Status: No, score=0.002 tagged_above=-999 required=5 tests=[AWL=0.013, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UUMKgI1hpWVu for ; Mon, 17 Sep 2018 05:01:47 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 5A4AB6DE0B7C for ; Mon, 17 Sep 2018 05:01:47 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1g1sDo-0006LM-DB; Mon, 17 Sep 2018 08:01:44 -0400 Received: (nullmailer pid 13446 invoked by uid 1000); Mon, 17 Sep 2018 12:01:43 -0000 From: David Bremner To: Vincent Breitmoser , notmuch@notmuchmail.org Subject: Re: [PATCH 1/2] completion: more complete completion for zsh. In-Reply-To: <20180916222943.21250-1-look@my.amazin.horse> References: <20180916222943.21250-1-look@my.amazin.horse> Date: Mon, 17 Sep 2018 09:01:43 -0300 Message-ID: <877ejk49js.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Sep 2018 12:01:48 -0000 Vincent Breitmoser writes: > --- /dev/null > +++ b/completion/zsh/_email-notmuch > @@ -0,0 +1,9 @@ > +#autoload > + > +local expl > +local -a notmuch_addr > + > +notmuch_addr=( ${(f)"$(notmuch address --deduplicate=address --output=address -- $PREFIX'*')"} ) > + > +_description notmuch-addr expl 'email address (notmuch)' > +compadd "$expl[@]" -a notmuch_addr This completion only works on the first word in the email address, because xapian search is word based. As an example to:look completes to look@my.amazin.horse to:look@ lists some odd things like localhost and ip6-loopback, along with look@my.amazin.horse to:look@m no completions It's possible it would make sense to use regex search here (only available with to: and from: prefixes), although I'd be cautious about the performance impact. Untested, but the search term would then look like from:/$PREFIX/ In my unscientific tests, % notmuch address --output=address from:/bremn/ took about 0.2s, while % notmuch address --output=address from:bremn\* took 0.147s That's not really a fair test, since your current query matches against the body as well, and is slower % notmuch address --output=address bremn\* takes about 0.5s