From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: peder@news.klingenberg.no (Peder O. Klingenberg) Newsgroups: gmane.emacs.devel Subject: Small patch to emacsbug.el Date: Tue, 28 Oct 2014 14:49:55 +0100 Organization: Persons in a Position to Know, inc. Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1414505136 1652 80.91.229.3 (28 Oct 2014 14:05:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Oct 2014 14:05:36 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 28 15:05:30 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xj7Or-0005B1-Qr for ged-emacs-devel@m.gmane.org; Tue, 28 Oct 2014 15:05:29 +0100 Original-Received: from localhost ([::1]:39379 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xj7Or-00054d-CB for ged-emacs-devel@m.gmane.org; Tue, 28 Oct 2014 10:05:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xj7Og-00053s-19 for emacs-devel@gnu.org; Tue, 28 Oct 2014 10:05:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xj7OX-00037f-6t for emacs-devel@gnu.org; Tue, 28 Oct 2014 10:05:17 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:45752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xj7OX-00037C-0m for emacs-devel@gnu.org; Tue, 28 Oct 2014 10:05:09 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Xj79z-0002Xg-1u for emacs-devel@gnu.org; Tue, 28 Oct 2014 14:50:07 +0100 Original-Received: from luna.netfonds.no ([80.91.225.79]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Oct 2014 14:50:07 +0100 Original-Received: from peder by luna.netfonds.no with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Oct 2014 14:50:07 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 85 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: luna.netfonds.no User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:tIKjWr3T1bq/R2/A84VBC6fAO4Q= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:175920 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=emacsbug.patch 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 + + * mail/emacsbug.el (report-emacs-bug): Make a better guess at + envelope-from when reporting through sendmail. + 2014-10-24 Martin Rudalics * 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 --=-=-=--