Re: [PATCH 1/2] completion: more complete completion for zsh.

Subject: Re: [PATCH 1/2] completion: more complete completion for zsh.

Date: Mon, 17 Sep 2018 09:01:43 -0300

To: Vincent Breitmoser, notmuch@notmuchmail.org

Cc:

From: David Bremner


Vincent Breitmoser <look@my.amazin.horse> 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<TAB>     completes to look@my.amazin.horse
to:look@<TAB>    lists some odd things like localhost and ip6-loopback,
                 along with look@my.amazin.horse
to:look@m<TAB>   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


_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: