[PATCH] try regexp searching for completion

David Bremner david at tethera.net
Thu Sep 20 17:08:39 PDT 2018


Can you try this alternative to caching, and see if the performance is
acceptable for you? I think it should be faster than your original
implementation (and also work better with multiple word foo at beep.boop

For me this is performs much nicer than the "read all the addresses"
version w/o caching. This makes it nicer out of the box for users
(like me, it turns out) who don't have completion caching turned on.

I haven't come up with a completely convincing case where caching
leaks information, but two potentially interesting scenarios are as

1) users of the "notmuch-remote" hack, which shims notmuch commands
via ssh to a remote host which might be more trusted than the local
one. This is not compelling for me because I guess shimming address
completion across ssh will be unusably slow.

2) In a future implementation of protected headers which actually
understands protected From, notmuch-address might grow a --decrypt
option. This is purely hypothetical at this point.

completion/zsh/_email-notmuch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/completion/zsh/_email-notmuch b/completion/zsh/_email-notmuch
index 291c2358..1cd0d78f 100644
--- a/completion/zsh/_email-notmuch
+++ b/completion/zsh/_email-notmuch
@@ -3,7 +3,7 @@
 local expl
 local -a notmuch_addr
-notmuch_addr=( ${(f)"$(notmuch address --deduplicate=address --output=address -- $PREFIX'*')"} )
+notmuch_addr=( ${(f)"$(notmuch address --deduplicate=address --output=address -- from:/$PREFIX/)"} )
 _description notmuch-addr expl 'email address (notmuch)'
 compadd "$expl[@]" -a notmuch_addr

More information about the notmuch mailing list