From df9736f20be0aa4db96e3ceaccb4f614ecbd4a9b Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sun, 20 Nov 2016 16:50:33 +0000 Subject: [PATCH] emacs: address: move address-full-harvest-finished to a function This makes the code access notmuch-address-full-harvest-finished via a helper function, notmuch-address--harvest-ready. Later we will use this to check whether we can load the harvest instead of regenerating it. --- emacs/notmuch-address.el | 8 ++++++-- emacs/notmuch-company.el | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/emacs/notmuch-address.el b/emacs/notmuch-address.el index b3c56cfa..2eaca795 100644 --- a/emacs/notmuch-address.el +++ b/emacs/notmuch-address.el @@ -37,7 +37,11 @@ (defvar notmuch-address-full-harvest-finished nil "t indicates that full completion address harvesting has been -finished") +finished. Use notmuch-address--harvest-ready to access.") + +(defun notmuch-address--harvest-ready () + "Return t if there is a full address hash available." + notmuch-address-full-harvest-finished) (defcustom notmuch-address-command 'internal "Determines how address completion candidates are generated. @@ -170,7 +174,7 @@ elisp-based implementation or older implementation requiring external commands." (cond ((eq notmuch-address-command 'internal) - (when (not notmuch-address-full-harvest-finished) + (unless (notmuch-address--harvest-ready) ;; First, run quick synchronous harvest based on what the user ;; entered so far (notmuch-address-harvest original t)) diff --git a/emacs/notmuch-company.el b/emacs/notmuch-company.el index ebe2c084..dca6471b 100644 --- a/emacs/notmuch-company.el +++ b/emacs/notmuch-company.el @@ -41,7 +41,7 @@ (declare-function notmuch-address-harvest "notmuch-address") (declare-function notmuch-address-harvest-trigger "notmuch-address") (declare-function notmuch-address-matching "notmuch-address") -(defvar notmuch-address-full-harvest-finished) +(declare-function notmuch-address--harvest-ready "notmuch-address") (defvar notmuch-address-completion-headers-regexp) ;;;###autoload @@ -70,7 +70,7 @@ (line-beginning-position)) (setq notmuch-company-last-prefix (company-grab "[:,][ \t]*\\(.*\\)" 1 (point-at-bol))))) (candidates (cond - (notmuch-address-full-harvest-finished + ((notmuch-address--harvest-ready) ;; Update harvested addressed from time to time (notmuch-address-harvest-trigger) (notmuch-address-matching arg)) -- 2.43.0