]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-address.el
emacs: address: move address-full-harvest-finished to a function
[notmuch] / emacs / notmuch-address.el
index 5b2beefeb823c906280755ed4da121fe209969ee..2eaca7958bb2736de3e21abe0e04a5946f95ab96 100644 (file)
 
 (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.
@@ -147,11 +151,11 @@ toggles the setting in this buffer."
   (interactive)
   (if (local-variable-p 'notmuch-address-command)
       (kill-local-variable 'notmuch-address-command)
-    (setq-local notmuch-address-command 'internal))
+    (notmuch-setq-local notmuch-address-command 'internal))
   (if (boundp 'company-idle-delay)
       (if (local-variable-p 'company-idle-delay)
          (kill-local-variable 'company-idle-delay)
-       (setq-local company-idle-delay nil))))
+       (notmuch-setq-local company-idle-delay nil))))
 
 (defun notmuch-address-matching (substring)
   "Returns a list of completion candidates matching SUBSTRING.
@@ -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))