[PATCH v1 2/2] emacs: Call `notmuch-mua-send-hook' hooks when sending a message

David Bremner david at tethera.net
Wed Sep 26 18:39:30 PDT 2018


$David Edmondson <dme at dme.org> writes:

> Previously any hook functions attached to `notmuch-mua-send-hook' were
> ignored.
> ---
>  emacs/notmuch-mua.el | 1 +
>  test/T310-emacs.sh   | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index fc8ac687..df2ac447 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -543,6 +543,7 @@ unencrypted.  Really send? "))))
>  
>  (defun notmuch-mua-send-common (arg &optional exit)
>    (interactive "P")
> +  (run-hooks 'notmuch-mua-send-hook)
>    (when (and (notmuch-mua-check-no-misplaced-secure-tag)
>  	     (notmuch-mua-check-secure-tag-has-newline))
>      (letf (((symbol-function 'message-do-fcc) #'notmuch-maildir-message-do-fcc))
> diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
> index d743abb7..5935819f 100755
> --- a/test/T310-emacs.sh
> +++ b/test/T310-emacs.sh
> @@ -1107,7 +1107,6 @@ output=$(test_emacs "(mapcar 'notmuch-escape-boolean-term (list
>  test_expect_equal "$output" '("\"\"" "abc`~!@#$%^&*-=_+123" "\"(abc\"" "\")abc\"" "\"\"\"abc\"" "\"'$'\x01''xyz\"" "\"“xyz”\"")'
>  

This looks plausible to me, and of course the test passes. I did wonder
if this means that people actually using notmuch-user-agent would run
the hook twice now?

On a related topic, I'd like to stop globally setting mail-user-agent in
notmuch.el. Notmuch users are still welcome to customize it, but we
don't need this side effect for regular notmuch use.

d


More information about the notmuch mailing list