From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mike Kupfer Newsgroups: gmane.emacs.devel Subject: [PATCH] Fix Subject when forwarding message with 2-line From Date: Fri, 26 Nov 2021 17:49:18 -0800 Message-ID: <13268.1637977758@alto> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38127"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 27 02:52:51 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mqmtW-0009hk-Iz for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Nov 2021 02:52:50 +0100 Original-Received: from localhost ([::1]:45546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mqmtT-00037B-Ns for ged-emacs-devel@m.gmane-mx.org; Fri, 26 Nov 2021 20:52:47 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqmqH-0002Fc-Jy for emacs-devel@gnu.org; Fri, 26 Nov 2021 20:49:29 -0500 Original-Received: from shell1.rawbw.com ([198.144.192.42]:57870) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mqmqF-00071z-1i for emacs-devel@gnu.org; Fri, 26 Nov 2021 20:49:29 -0500 Original-Received: from alto (96-95-200-133-static.hfc.comcastbusiness.net [96.95.200.133]) (authenticated bits=0) by shell1.rawbw.com (8.15.1/8.15.1) with ESMTPSA id 1AR1nIGV064084 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Fri, 26 Nov 2021 17:49:24 -0800 (PST) (envelope-from mkupfer@alum.berkeley.edu) X-Authentication-Warning: shell1.rawbw.com: Host 96-95-200-133-static.hfc.comcastbusiness.net [96.95.200.133] claimed to be alto X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 28.0.60 Received-SPF: none client-ip=198.144.192.42; envelope-from=mkupfer@alum.berkeley.edu; helo=shell1.rawbw.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:280281 Archived-At: --=-=-= Content-Type: text/plain Hi, is the attached patch to MH-E eligible for emacs-28, or should it go into master? The patch fixes a problem that happens when forwarding an email that has a 2-line From line, e.g., From: "Some User" To: Another User Subject: 2-line From Without the fix, the user is presented with a corrupted set of headers, e.g., From: Mike Kupfer To: cc: Fcc: +inbox Subject: "Some User" X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 28.0.60 : 2-line From With the fix, the headers are correct, e.g., From: Mike Kupfer To: cc: Fcc: +inbox Subject: "Some User": 2-line From X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 28.0.60 The problem exists in Emacs 27, so this isn't fixing a regression. On the other hand, it only affects forwarding with MH-E. thanks, mike --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-Subject-when-forwarding-message-with-2-line-From.patch Content-Description: proposed patch >From 0d77d7f483889ad42a38f8e05deffc2ff7d527c9 Mon Sep 17 00:00:00 2001 From: Mike Kupfer Date: Fri, 26 Nov 2021 13:59:14 -0800 Subject: [PATCH] Fix Subject when forwarding message with 2-line From * lisp/mh-e/mh-comp.el (mh-forwarded-letter-subject): Collapse two-line From headers into a single line (SF#266). Based on a suggestion from Lester Buck (many thanks!). --- lisp/mh-e/mh-comp.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/mh-e/mh-comp.el b/lisp/mh-e/mh-comp.el index 404b6b3ce7..e44c42e280 100644 --- a/lisp/mh-e/mh-comp.el +++ b/lisp/mh-e/mh-comp.el @@ -638,6 +638,8 @@ mh-forward (defun mh-forwarded-letter-subject (from subject) "Return a Subject suitable for a forwarded message. Original message has headers FROM and SUBJECT." + ;; Join continued lines. + (setq from (replace-regexp-in-string "\\s *\n\\s +" " " from)) (let ((addr-start (string-search "<" from)) (comment (string-search "(" from))) (cond ((and addr-start (> addr-start 0)) -- 2.20.1 --=-=-=--