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

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

Date: Tue, 18 Aug 2020 12:23:24 +1000

To: notmuch@notmuchmail.org

Cc:

From: Tim Quelch


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`

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

Thanks,
Tim
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: