unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / Atom feed
* emacs: `message-send-hook` being called twice
@ 2020-08-18  2:23 Tim Quelch
  2020-08-18  9:53 ` David Edmondson
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Quelch @ 2020-08-18  2:23 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: emacs: `message-send-hook` being called twice
  2020-08-18  2:23 emacs: `message-send-hook` being called twice Tim Quelch
@ 2020-08-18  9:53 ` David Edmondson
  0 siblings, 0 replies; 2+ messages in thread
From: David Edmondson @ 2020-08-18  9:53 UTC (permalink / raw)
  To: Tim Quelch, notmuch

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-18  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18  2:23 emacs: `message-send-hook` being called twice Tim Quelch
2020-08-18  9:53 ` David Edmondson

unofficial mirror of notmuch@notmuchmail.org

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/notmuch/0 notmuch/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 notmuch notmuch/ https://yhetil.org/notmuch \
		notmuch@notmuchmail.org
	public-inbox-index notmuch

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.mail.notmuch.general
	nntp://news.gmane.io/gmane.mail.notmuch.general


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git