message.el and browse-url.el interaction [was: Re: BUG: notmuch-emacs-mua wrong signing MML placement]
David Edmondson
dme at dme.org
Thu Dec 12 01:46:28 PST 2019
On Wednesday, 2019-12-11 at 13:55:16 -05, Robbie Harwood wrote:
> My emacs config contains `(add-hook 'message-setup-hook
> 'mml-secure-sign-pgpmime)` as recommended in the emacstips
> https://notmuchmail.org/emacstips/#index14h2
>
> However, when I run (something like):
>
> notmuch-emacs-mua 'mailto:testto?body=testbody'
>
> I get an email in which the requested body contents appear *before* the
> signing MML. If I understand correctly how this all fits together, that
> won't do the right thing - but at any rate, it's unexpected.
This is an unfortunate interaction between message.el and browse-url.el
and isn't specific to notmuch or notmuch-emacs-mua.
You can see the same behaviour in “emacs -Q -q” if you execute:
(progn
(add-hook 'message-setup-hook 'mml-secure-sign-pgpmime)
(browse-url-mail "mailto:fred?body=testbody"))
Given that, it's not something that we should be fixing in notmuch
itself, as it's an emacs bug.
The problem is that `browse-url-mail' always inserts the body after the
header separator, which in this case happens after
`mml-secure-sign-pgpmime' has already inserted the MML header.
Having `browse-url-mail' insert the body at the end of the message would
work for this case, but would presumably make a mess of situations where
someone inserts their signature block via `message-setup-hook'.
Perhaps `browse-url-mail' should skip past any MML headers before
inserting the body? That's a bit messy, as browse-url.el currently
doesn't know anything about MML.
The nicest fix would perhaps be to have `compose-mail' accept the
initial body as a parameter, which would eventually flow into the
relevant code in message.el which could do the right thing (which I
think would just be to skip past MML headers before inserting the body).
Any advice from emacs-devel on how to move forward? I'm happy to produce
a patch for whatever solution is considered most appropriate.
dme.
--
If the girls start moving the boys will start moving.
More information about the notmuch
mailing list