aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Walters <markwalters1009@gmail.com>2016-11-20 16:50:33 +0000
committerDavid Bremner <david@tethera.net>2017-01-27 22:07:43 -0400
commitdf9736f20be0aa4db96e3ceaccb4f614ecbd4a9b (patch)
tree8f4d1c222760d16dcdfa0c751860a2e357051876
parent3f5257cec271c05d82f8fda129066e9f285689f5 (diff)
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.
-rw-r--r--emacs/notmuch-address.el8
-rw-r--r--emacs/notmuch-company.el4
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))