Re: [BUG] notmuch-emacs: spoils sendmail -f with emacs 27 commit 3a59cc84069376802ba8fd731b524d78db58262c and later

Subject: Re: [BUG] notmuch-emacs: spoils sendmail -f with emacs 27 commit 3a59cc84069376802ba8fd731b524d78db58262c and later

Date: Tue, 03 Dec 2019 19:42:22 +0000

To: Gregor Zattler, notmuch

Cc: Stefan Monnier

From: David Edmondson

On Tuesday, 2019-12-03 at 20:15:02 +01, Gregor Zattler wrote:

>> As best I can determine, this relates to the order in which things are
>> loaded.
>> If you load message.el before setting `mail-specify-envelope-from',
>> things are broken (sorry for the long lines):
>> disaster-area ~/s/emacs % ./src/emacs -Q -nw -batch --eval "(progn (require 'message) (setq mail-specify-envelope-from t mail-envelope-from 'header) (message \"%s\" message-sendmail-envelope-from))"
>> nil
>> disaster-area ~/s/emacs % 
>> ...but if you load it after, things work fine:
>> disaster-area ~/s/emacs % ./src/emacs -Q -nw -batch --eval "(progn (setq mail-specify-envelope-from t mail-envelope-from 'header) (require 'message) (message \"%s\" message-sendmail-envelope-from))"
>> header
>> disaster-area ~/s/emacs %
>> This doesn't appear to be new behaviour - 26.1 does the same.
> this is astonishing, since my test script behaves different with
> emacs build with different last commits!?

There may well be other layers of complication :-)

>> This is related to the way that `message-sendmail-envelope-from' is
>> initialised from `mail-envelope-from', and it's
>> `message-sendmail-envelope-from' that matters, because you end up in
>> `message-send-mail-with-sendmail'.
> At the moment I cannot follow...

At least in 27, I don't think that you end up using `sendmail-send-it',
because I don't believe that message.el is looking at

>> message.el is being loaded by “(require 'notmuch)” in your example,
>> which is happening before `mail-specify-envelope-from' is set, so you
>> see the failure mode described.
> ... but in my example the setq forms precede every call to
> message/notmuch (as in your example)!?

That's not the case. Your example is:

> ~/src/emacs/src/emacs -Q -nw -L ~/src/notmuch/emacs/ --eval "(require 'notmuch)" -f notmuch -l /tmp/test.el

This loads (via the require) notmuch.el, and consequently message.el,
*before* it loads /tmp/test.el, so the setq calls happen after
message.el has been loaded.

> [And in my emacs configuration the customizations made with emacs'
> customization interface (among others the three variables which are
> setq in my test script) are loaded before almost anything else,
> especially message/notmuch, see below]
>> The example you provided is obviously contrived to show the problem -
>> are you hitting it in normal use?
> Absolutely.  I struggle with this at least since 2nd of August and have
> reproduced this behaviour dozens of times.  It took my several
> attempts to isolate the problem.
> I use version
> 1.57 as of 2018-06-05 in order to send emails through different
> smarthosts.
> I do this every day and with emacs from sources newer than commit
> 01739625704aaaea6831cef459a4a53171689513 I'm e.g. not able to send
> emails with my work email address ot to this mailing list.  This
> is especially annoying since sending fails silently.  So
> relatively important emails as e.g. announcements of downtimes did
> not reach their intended audience.
> The whole thing is above my elisp knowledge.  Is it possible you
> describe something which is not the problem I described?

I think that the above explanation applies to the example that you
provided here. There may well be a different explanation for what
happens with your real configuration.

I had my eyes closed in the dark.
notmuch mailing list