unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mike Kupfer <mkupfer@alum.berkeley.edu>
To: emacs-devel@gnu.org
Subject: [PATCH] Fix Subject when forwarding message with 2-line From
Date: Fri, 26 Nov 2021 17:49:18 -0800	[thread overview]
Message-ID: <13268.1637977758@alto> (raw)

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

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"
    <some.user@company.com>
  To: Another User <another.user@another-company.com>
  Subject: 2-line From

Without the fix, the user is presented with a corrupted set of headers,
e.g.,

  From: Mike Kupfer <mkupfer@alum.berkeley.edu>
  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 <mkupfer@alum.berkeley.edu>
  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

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

From 0d77d7f483889ad42a38f8e05deffc2ff7d527c9 Mon Sep 17 00:00:00 2001
From: Mike Kupfer <mkupfer@alum.berkeley.edu>
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


             reply	other threads:[~2021-11-27  1:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-27  1:49 Mike Kupfer [this message]
2021-11-27  6:15 ` [PATCH] Fix Subject when forwarding message with 2-line From Eli Zaretskii
2021-11-27 15:59   ` Mike Kupfer
2021-11-27 16:58     ` Eli Zaretskii

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://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=13268.1637977758@alto \
    --to=mkupfer@alum.berkeley.edu \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).