Re: [PATCH] emacs: Remove notmuch-mua-message-send-hook

Subject: Re: [PATCH] emacs: Remove notmuch-mua-message-send-hook

Date: Sun, 13 Sep 2020 12:53:54 +0300

To: Tim Quelch, notmuch@notmuchmail.org

Cc: Tim Quelch

From: Tomi Ollila


On Sat, Sep 12 2020, Tim Quelch wrote:

> Currently `message-send-hook` functions are being called twice: In
> notmuch send common when `notmuch-mua-send-hook` functions are
> run (which by default includes `notmuch-mua-message-send-hook`) and in
> `message-send` itself.
>
> Because `message-send-hook` functions are run in `message-send` itself,
> we don't need also need to run them before we delegate to `message-send`
>
> Calling `notmuch-mua-message-send-hook` resulted in functions in
> `message-send-hook` to be called twice. This causes bugs in
> non-idempotent hook functions.

Looks good to me. everyone who rewrote notmuch-mua-message-send-hook
(i hope none) have to find better solution (or just...)

Hmm, this is defcustom. If that (old default) is stored in 
custom-set-variables have to remove it -- at least my  
custom-set-variables does not reference to this hook variable, so
most probably the effect (if any) is small...

Tomi

> ---
>  emacs/notmuch-mua.el | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index dcddca76..03c7cc97 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -40,7 +40,7 @@
>  
>  ;;
>  
> -(defcustom notmuch-mua-send-hook '(notmuch-mua-message-send-hook)
> +(defcustom notmuch-mua-send-hook nil
>    "Hook run before sending messages."
>    :type 'hook
>    :group 'notmuch-send
> @@ -601,11 +601,6 @@ unencrypted.  Really send? "))))
>    (interactive)
>    (message-kill-buffer))
>  
> -(defun notmuch-mua-message-send-hook ()
> -  "The default function used for `notmuch-mua-send-hook', this
> -simply runs the corresponding `message-mode' hook functions."
> -  (run-hooks 'message-send-hook))
> -
>  ;;
>  
>  (define-mail-user-agent 'notmuch-user-agent
> -- 
> 2.28.0
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: