Re: emacs: `message-send-hook` being called twice

Subject: Re: emacs: `message-send-hook` being called twice

Date: Tue, 18 Aug 2020 10:53:05 +0100

To: Tim Quelch, notmuch@notmuchmail.org

Cc:

From: David Edmondson


On Tuesday, 2020-08-18 at 12:23:24 +10, Tim Quelch wrote:

> Hi all,
>
> I've been working through a bug that I've been having with org-msg
> (https://github.com/jeremy-compostella/org-msg/issues/58#issuecomment-675177076)
> and it looks like a bug in the internals of notmuch.
>
> It appears as though the `message-send-hooks` are being called twice,
> 1. In `notmuch-mua-send-common` when `notmuch-mua-send-hook` are run
> (which by default is set to `notmuch-mua-message-send-hook`, which just
> runs `message-send-hook`)
> 2. When `notmuch-mua-send-common` delegates sending of the message to
> `message-send` or `message-send-and-exit`. These functions both run `message-send-hook`
>
> The specific issue this was causing in org-msg was that the message was
> being converted to html twice, causing raw html to be included in the
> sent message. This kind of issue could easily pop up again with other
> non-idempotent hook functions.
>
> I was wondering what the design descision was to set up
> `notmuch-mua-send-hook` to delegate to running `message-send-hook` when
> this is already done in `message-send`

Honestly, I don't remember. It was a long time ago.

> If this was not intentional, I don't think `notmuch-mua-send-hook` needs
> to contain `notmuch-mua-message-send-hook` by default.

I agree that it's a bug - `notmuch-mua-message-send-hook' should
probably just die.

dme.
-- 
Stop the music and go home.
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: