[PATCH] completion: load all addresses and cache in _email-notmuch
Vincent Breitmoser
look at my.amazin.horse
Mon Sep 17 14:08:52 PDT 2018
---
completion/zsh/_email-notmuch | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/completion/zsh/_email-notmuch b/completion/zsh/_email-notmuch
index 291c2358..c6db00b6 100644
--- a/completion/zsh/_email-notmuch
+++ b/completion/zsh/_email-notmuch
@@ -2,8 +2,14 @@
local expl
local -a notmuch_addr
+local notmuch_addr_lastmod
+local lastmod=( ${(f)"$(notmuch count --lastmod)"} )
-notmuch_addr=( ${(f)"$(notmuch address --deduplicate=address --output=address -- $PREFIX'*')"} )
+if ! _retrieve_cache notmuch-addresses || [[ $lastmod != $notmuch_addr_lastmod ]]; then
+ notmuch_addr_lastmod=$lastmod
+ notmuch_addr=( ${(f)"$(notmuch address --deduplicate=address --output=address -- '*')"} )
+ _store_cache notmuch-addresses notmuch_addr notmuch_addr_lastmod
+fi
_description notmuch-addr expl 'email address (notmuch)'
compadd "$expl[@]" -a notmuch_addr
--
2.18.0
More information about the notmuch
mailing list