* [PATCH] Fix Subject when forwarding message with 2-line From
@ 2021-11-27 1:49 Mike Kupfer
2021-11-27 6:15 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Mike Kupfer @ 2021-11-27 1:49 UTC (permalink / raw)
To: emacs-devel
[-- 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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix Subject when forwarding message with 2-line From
2021-11-27 1:49 [PATCH] Fix Subject when forwarding message with 2-line From Mike Kupfer
@ 2021-11-27 6:15 ` Eli Zaretskii
2021-11-27 15:59 ` Mike Kupfer
0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2021-11-27 6:15 UTC (permalink / raw)
To: Mike Kupfer; +Cc: emacs-devel
> From: Mike Kupfer <mkupfer@alum.berkeley.edu>
> Date: Fri, 26 Nov 2021 17:49:18 -0800
>
> Hi, is the attached patch to MH-E eligible for emacs-28, or should it go
> into master?
I don't use MH-E, so I don't know how severe is the problem. Can you
tell? If uit's severe, how come it wasn't fixed till now?
In any case, isn't the fix more than absolutely necessary? If all you
want is replace newlines with spaces, why not do just that? Or what
am I missing?
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix Subject when forwarding message with 2-line From
2021-11-27 6:15 ` Eli Zaretskii
@ 2021-11-27 15:59 ` Mike Kupfer
2021-11-27 16:58 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Mike Kupfer @ 2021-11-27 15:59 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Eli Zaretskii wrote:
> > From: Mike Kupfer <mkupfer@alum.berkeley.edu>
> > Date: Fri, 26 Nov 2021 17:49:18 -0800
> >
> > Hi, is the attached patch to MH-E eligible for emacs-28, or should it go
> > into master?
>
> I don't use MH-E, so I don't know how severe is the problem. Can you
> tell?
I think the argument for fixing it now is this: if the user doesn't
notice the problem and fix it before pressing C-c C-c, the attempt to
forward can fail (e.g., get bounced by the mail server) because of the
messed-up headers, and the user might have a hard time figuring out what
happened.
On the other hand, I think 2-line From headers are fairly rare. I don't
think I've ever hit this bug. Lester (the person thanked in the
changeset comment) reported seeing it "once in awhile". It's been on
the MH-E bug list (on SourceForge) since 2012.
> In any case, isn't the fix more than absolutely necessary? If all you
> want is replace newlines with spaces, why not do just that? Or what
> am I missing?
If mh-forwarded-letter-subject doesn't eat the whitespaces around the
newline, you can get a Subject line that looks like
Subject: "Some User" : 2-line From
It's functional, I suppose, but the ":" is supposed to come immediately
after the name ("Some User" here).
mike
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix Subject when forwarding message with 2-line From
2021-11-27 15:59 ` Mike Kupfer
@ 2021-11-27 16:58 ` Eli Zaretskii
0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2021-11-27 16:58 UTC (permalink / raw)
To: Mike Kupfer; +Cc: emacs-devel
> From: Mike Kupfer <mkupfer@alum.berkeley.edu>
> cc: emacs-devel@gnu.org
> Date: Sat, 27 Nov 2021 07:59:45 -0800
>
> Eli Zaretskii wrote:
>
> > > From: Mike Kupfer <mkupfer@alum.berkeley.edu>
> > > Date: Fri, 26 Nov 2021 17:49:18 -0800
> > >
> > > Hi, is the attached patch to MH-E eligible for emacs-28, or should it go
> > > into master?
> >
> > I don't use MH-E, so I don't know how severe is the problem. Can you
> > tell?
>
> I think the argument for fixing it now is this: if the user doesn't
> notice the problem and fix it before pressing C-c C-c, the attempt to
> forward can fail (e.g., get bounced by the mail server) because of the
> messed-up headers, and the user might have a hard time figuring out what
> happened.
>
> On the other hand, I think 2-line From headers are fairly rare. I don't
> think I've ever hit this bug. Lester (the person thanked in the
> changeset comment) reported seeing it "once in awhile". It's been on
> the MH-E bug list (on SourceForge) since 2012.
Mmm... I guess it's okay to do this on the release branch. Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-27 16:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-27 1:49 [PATCH] Fix Subject when forwarding message with 2-line From Mike Kupfer
2021-11-27 6:15 ` Eli Zaretskii
2021-11-27 15:59 ` Mike Kupfer
2021-11-27 16:58 ` Eli Zaretskii
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.