unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: David Edmondson <dme@dme.org>
Cc: Gregor Zattler <telegraph@gmx.net>,  notmuch <notmuch@notmuchmail.org>
Subject: Re: [BUG] notmuch-emacs: spoils sendmail -f with emacs 27 commit 3a59cc84069376802ba8fd731b524d78db58262c and later
Date: Tue, 03 Dec 2019 15:39:47 -0500	[thread overview]
Message-ID: <jwvo8wp87q6.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <m2muc945e3.fsf@dme.org> (David Edmondson's message of "Tue, 03 Dec 2019 18:43:00 +0000")

> 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 % 

Ha!  Thanks for tracking it down.

I installed the patch below into `master` to try and avoid this problem.


        Stefan


diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index f33454e704..e60ea4f0e8 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -854,18 +854,24 @@ message-sendmail-f-is-evil
   :type 'boolean)
 
 (defcustom message-sendmail-envelope-from
-  ;; `mail-envelope-from' is unavailable unless sendmail.el is loaded.
-  (if (boundp 'mail-envelope-from) mail-envelope-from)
+  'obey-mail-envelope-from
   "Envelope-from when sending mail with sendmail.
 If this is nil, use `user-mail-address'.  If it is the symbol
 `header', use the From: header of the message."
-  :version "23.2"
+  :version "27.1"
   :type '(choice (string :tag "From name")
 		 (const :tag "Use From: header from message" header)
+		 (const :tag "Obey `sendmail-envelope-from'"
+		        obey-mail-envelope-from)
 		 (const :tag "Use `user-mail-address'" nil))
   :link '(custom-manual "(message)Mail Variables")
   :group 'message-sending)
 
+(defun message--sendmail-envelope-from ()
+  (if (eq message-sendmail-envelope-from 'obey-mail-envelope-from)
+      (if (boundp 'mail-envelope-from) mail-envelope-from)
+    message-sendmail-envelope-from))
+
 (defcustom message-sendmail-extra-arguments nil
   "Additional arguments to `sendmail-program'."
   ;; E.g. '("-a" "account") for msmtp
@@ -5884,11 +5890,11 @@ message-user-mail-address
 
 (defun message-sendmail-envelope-from ()
   "Return the envelope from."
-  (cond ((eq message-sendmail-envelope-from 'header)
+  (cond ((eq (message--sendmail-envelope-from) 'header)
 	 (nth 1 (mail-extract-address-components
 		 (message-fetch-field "from"))))
-	((stringp message-sendmail-envelope-from)
-	 message-sendmail-envelope-from)
+	((stringp (message--sendmail-envelope-from))
+	 (message--sendmail-envelope-from))
 	(t
 	 (message-make-address))))
 
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index 1c2f11680b..fea7619b50 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -239,8 +239,8 @@ report-emacs-bug
       ;; Stop message-mode stealing the properties we will add.
       (set (make-local-variable 'message-strip-special-text-properties) nil)
       ;; Make sure we default to the From: address as envelope when sending
-      ;; through sendmail.
-      (when (and (not message-sendmail-envelope-from)
+      ;; through sendmail.  FIXME: Why?
+      (when (and (not (message--sendmail-envelope-from))
 		 (message-bogus-recipient-p (message-make-address)))
 	(set (make-local-variable 'message-sendmail-envelope-from) 'header)))
     (rfc822-goto-eoh)

  parent reply	other threads:[~2019-12-03 20:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-01 17:10 [BUG] notmuch-emacs: spoils sendmail -f with emacs 27 commit 3a59cc84069376802ba8fd731b524d78db58262c and later Gregor Zattler
2019-12-03 18:43 ` David Edmondson
2019-12-03 19:15   ` Gregor Zattler
2019-12-03 19:42     ` David Edmondson
2019-12-04 12:03     ` David Edmondson
2019-12-03 20:39   ` Stefan Monnier [this message]
2019-12-03 22:22     ` David Edmondson
2019-12-03 23:10       ` Stefan Monnier
2019-12-04 18:13         ` Gregor Zattler

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=jwvo8wp87q6.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=dme@dme.org \
    --cc=notmuch@notmuchmail.org \
    --cc=telegraph@gmx.net \
    /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).