[PATCH] try regexp searching for completion

Subject: [PATCH] try regexp searching for completion

Date: Thu, 20 Sep 2018 21:08:39 -0300

To: Vincent Breitmoser, notmuch@notmuchmail.org

Cc:

From: David Bremner


---

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@beep.boop
prefixes).

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
follows:

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
-- 
2.18.0

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

Thread: