This hook can be used to update the message based on the results of
address completion. For example using message-templ or gnus-alias to set
the From address based on the To address just completed.
The post-completion command is added to the notmuch-company backend to
ensure that the hook is also called company completion is started
without going through notmuch-address-expand-name. See the docstring of
`company-backends' for more information.
:group 'notmuch-send
:group 'notmuch-external)
+(defcustom notmuch-address-completion-hook 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)"
(progn
(push chosen notmuch-address-history)
(delete-region beg end)
- (insert chosen))
+ (insert chosen)
+ (run-hook-with-args 'notmuch-address-completion-hook chosen))
(message "No matches.")
(ding))))
(t nil)))
(match (if (string-match notmuch-company-last-prefix arg)
(match-end 0)
0))
+ (post-completion (run-hook-with-args 'notmuch-address-completion-hook arg))
(no-cache t))))