This loads all known email addresses for completion, and caches the result. The cache validity is based on `notmuch count --lastmod mid:nonexistent`. --- 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..89dfd414 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 mid:nonexistent)"} ) -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 _______________________________________________ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch