all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: peder@news.klingenberg.no (Peder O. Klingenberg)
To: emacs-devel@gnu.org
Subject: Small patch to emacsbug.el
Date: Tue, 28 Oct 2014 14:49:55 +0100	[thread overview]
Message-ID: <ksa94ggv7g.fsf@netfonds.no> (raw)

[-- Attachment #1: Type: text/plain, Size: 844 bytes --]

Earlier today I was bitten by something that has irritated be before as
well.  When reporting bugs from an "emacs -Q", emacs doesn't know my
email address.  No problem, I can edit the From: header.

However, I like to use my local sendmail as transport, because I have
already told that how and where to forward my mail, and it seems like a
perfectly good option.  But message.el then decides to make up its own
envelope-from, regardless of From: header.  That makes the mail bounce.

Attached is a patch to emacsbug.el that checks if what message.el would
do results in a bogus address, and if so, defaults to the From: header
instead.

(This is my first patch submission, let me know if it should be done
differently.  Copyright paperwork is on file since ages ago.)

...Peder...
-- 
I wish a new life awaited _me_ in some off-world colony.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: emacsbug.patch --]
[-- Type: text/x-diff, Size: 2288 bytes --]

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 821d4fd..75317c6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2014-10-28  Peder O. Klingenberg  <peder@klingenberg.no>
+
+	* mail/emacsbug.el (report-emacs-bug): Make a better guess at
+	  envelope-from when reporting through sendmail.
+
 2014-10-24  Martin Rudalics  <rudalics@gmx.at>
 
 	* mouse.el (mouse-drag-line): Don't use mouse-pixel-position.
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index 9145150..4ed212e 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -137,6 +137,12 @@ This requires either the OS X \"open\" command, or the freedesktop
 			   (concat "mailto:" to)))
 	(error "Subject, To or body not found")))))
 
+;; It's the default mail mode, so it seems OK to use its features.
+(autoload 'message-bogus-recipient-p "message")
+(autoload 'message-make-address "message")
+(defvar message-send-mail-function)
+(defvar message-sendmail-envelope-from)
+
 ;;;###autoload
 (defun report-emacs-bug (topic &optional recent-keys)
   "Report a bug in GNU Emacs.
@@ -165,7 +171,12 @@ Prompts for bug subject.  Leaves you in a mail buffer."
       ;; that report-emacs-bug-orig-text remains valid.  (Bug#5178)
       (message-sort-headers)
       ;; Stop message-mode stealing the properties we will add.
-      (set (make-local-variable 'message-strip-special-text-properties) nil))
+      (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)
+		 (message-bogus-recipient-p (message-make-address)))
+	(set (make-local-variable 'message-sendmail-envelope-from) 'header)))
     (rfc822-goto-eoh)
     (forward-line 1)
     ;; Move the mail signature to the proper place.
@@ -364,10 +375,6 @@ usually do not have translators for other languages.\n\n")))
 
 (define-obsolete-function-alias 'report-emacs-bug-info 'info-emacs-bug "24.3")
 
-;; It's the default mail mode, so it seems OK to use its features.
-(autoload 'message-bogus-recipient-p "message")
-(defvar message-send-mail-function)
-
 (defun report-emacs-bug-hook ()
   "Do some checking before sending a bug report."
   (save-excursion

             reply	other threads:[~2014-10-28 13:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-28 13:49 Peder O. Klingenberg [this message]
2014-10-28 16:16 ` Small patch to emacsbug.el Eli Zaretskii
2014-10-28 19:56   ` Peder O. Klingenberg

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

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

  git send-email \
    --in-reply-to=ksa94ggv7g.fsf@netfonds.no \
    --to=peder@news.klingenberg.no \
    --cc=emacs-devel@gnu.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.