]> git.eshelyaron.com Git - emacs.git/commitdiff
(report-emacs-bug): Make a better guess at envelope-from
authorPeder O. Klingenberg <peder@klingenberg.no>
Sat, 15 Nov 2014 15:22:29 +0000 (16:22 +0100)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Sat, 15 Nov 2014 15:22:29 +0000 (16:22 +0100)
Fixes: debbugs:19054
* mail/emacsbug.el (report-emacs-bug): Make a better guess at
  envelope-from when reporting through sendmail.

lisp/ChangeLog
lisp/mail/emacsbug.el

index a6ab3b87e4367bec84b8ffaa4972fdc846cc70ab..107b995619481133571d6ea2fffbad6cceda598d 100644 (file)
@@ -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 (bug#19054).
+
 2014-11-14  Ivan Andrus  <darthandrus@gmail.com>
 
        * progmodes/python.el (python-ffap-module-path): Use
index 329a3209ceef38ad7bb67ee8bc0c8e4df6335ed9..4cfd3e2051e3eafb04f2ee30a36ac04ff45c6ff9 100644 (file)
@@ -142,6 +142,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 unused)
   "Report a bug in GNU Emacs.
@@ -169,7 +175,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.
@@ -349,10 +360,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