unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Vincent Breitmoser <look@my.amazin.horse>
To: notmuch@notmuchmail.org
Subject: [PATCH] completion: load all addresses and cache in _email-notmuch
Date: Mon, 17 Sep 2018 23:08:52 +0200	[thread overview]
Message-ID: <20180917210852.4346-1-look@my.amazin.horse> (raw)
In-Reply-To: <871s9si90d.fsf@tethera.net>

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

  reply	other threads:[~2018-09-17 21:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-16 22:29 [PATCH 1/2] completion: more complete completion for zsh Vincent Breitmoser
2018-09-16 22:29 ` [PATCH 2/2] debian: update zsh completion installation Vincent Breitmoser
2018-09-17 12:01 ` [PATCH 1/2] completion: more complete completion for zsh David Bremner
2018-09-17 12:15 ` Vincent Breitmoser
2018-09-17 12:49   ` David Bremner
2018-09-17 21:08     ` Vincent Breitmoser [this message]
2018-09-21  0:08       ` [PATCH] try regexp searching for completion David Bremner
2018-09-17 21:12     ` forgot amending the commit :) Vincent Breitmoser
2018-09-17 21:12     ` [PATCH] completion: load all addresses and cache in _email-notmuch Vincent Breitmoser
2018-09-18 11:19 ` zsh completion finalized and squashed Vincent Breitmoser
2018-09-18 11:19   ` [PATCH 1/2] completion: more complete completion for zsh Vincent Breitmoser
2018-10-03  0:40     ` David Bremner
2018-09-18 11:19   ` [PATCH 2/2] debian: update zsh completion installation Vincent Breitmoser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180917210852.4346-1-look@my.amazin.horse \
    --to=look@my.amazin.horse \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).