]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-address.el
Merge branch 'release'
[notmuch] / emacs / notmuch-address.el
index b2e1fba797592869de3628d088e28f8f2aac9b53..b3c56cfaad9dc212b990559171c1df2499b39722 100644 (file)
@@ -98,6 +98,17 @@ to know how address selection is made by default."
   :group 'notmuch-send
   :group 'notmuch-external)
 
+(defcustom notmuch-address-post-completion-functions nil
+  "Functions called after completing address.
+
+The completed address is passed as an argument to each function.
+Note that this hook will be invoked for completion in headers
+matching `notmuch-address-completion-headers-regexp'.
+"
+  :type 'hook
+  :group 'notmuch-address
+  :group 'notmuch-hooks)
+
 (defun notmuch-address-selection-function (prompt collection initial-input)
   "Call (`completing-read'
       PROMPT COLLECTION nil nil INITIAL-INPUT 'notmuch-address-history)"
@@ -136,11 +147,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.
@@ -206,7 +217,8 @@ external commands."
          (progn
            (push chosen notmuch-address-history)
            (delete-region beg end)
-           (insert chosen))
+           (insert chosen)
+           (run-hook-with-args 'notmuch-address-post-completion-functions chosen))
        (message "No matches.")
        (ding))))
    (t nil)))