unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tim Quelch <tim@tquelch.com>
To: notmuch@notmuchmail.org
Subject: emacs: `message-send-hook` being called twice
Date: Tue, 18 Aug 2020 12:23:24 +1000	[thread overview]
Message-ID: <87mu2swv37.fsf@quelch.name> (raw)

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

             reply	other threads:[~2020-08-18  2:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18  2:23 Tim Quelch [this message]
2020-08-18  9:53 ` emacs: `message-send-hook` being called twice David Edmondson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mu2swv37.fsf@quelch.name \
    --to=tim@tquelch.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).