Discussion:
Reply-prefix ("Re:") default regex
Paul van der Walt
2015-08-15 11:43:51 UTC
Permalink
Hello Gnus,

This is my first post to this list, so please forgive me if i break all
the written and unwritten rules. [and my first posting hasn't showed up
after 16h, so this is potentially a double-post]

I recently ran into an issue where a French speaker i was communicating
with had "Re : ..." as their reply subject prefix (note the leading
space before the colon). This quickly ended up with us bouncing emails
around with such lovely subject lines as "Re: Re : Re: Re : Re: ...", et
cetera, ad infinitum. This phenomenon, of surrounding certain
punctuation marks with extra spaces, turns out to be A Thing™ in French
writing [0]. I discovered that by making a very small modification to
the term `message-subject-re-regexp`, the problem was solved for me,
locally (it's in my configuration files ATM). But since this might be
something that's useful to others, i threw a patch together, attached.

Of course, i could understand if such cultural (non-anglophone?) cruft
were undesirable in the Gnus code base, but perhaps others might benefit
from this. If not, i am sorry for wasting your collective time. If the
fix is desirable yet wrong in some other way, rest assured that you all
have my deepest apologies, i don't mean to step on anyone's toes.

Thank you and have a good day,
p.

0. <http://www.btb.termiumplus.gc.ca/tcdnstyl-chap?lang=eng&lettr=chapsect17&info0=17.07>
Peter Münster
2015-08-15 15:51:55 UTC
Permalink
Post by Paul van der Walt
Of course, i could understand if such cultural (non-anglophone?) cruft
were undesirable in the Gnus code base, but perhaps others might benefit
from this.
It's useful and I don't see any problem with that patch. Perhaps you
should repost it with a subject like "[PATCH] ..." or do M-x gnus-bug.
--
Peter
Paul van der Walt
2015-08-15 16:48:38 UTC
Permalink
* message.el (message-subject-re-regexp): Match French style ("Re :")
reply subject prefixes.
---
lisp/ChangeLog | 5 +++++
lisp/message.el | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 324f473..05d68f0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2015-08-14 Paul van der Walt <***@denknerd.org>
+
+ * message.el (message-subject-re-regexp): Match French style ("Re :")
+ reply subject prefixes.
+
2015-08-06 Paul Eggert <***@cs.ucla.edu>

* message.el (message-send-form-letter): Change (message (format ...))
diff --git a/lisp/message.el b/lisp/message.el
index 26655f3..54be212 100644
--- a/lisp/message.el
+++ b/lisp/message.el
@@ -300,7 +300,7 @@ any confusion."
regexp))

(defcustom message-subject-re-regexp
- "^[ \t]*\\([Rr][Ee]\\(\\[[0-9]*\\]\\)*:[ \t]*\\)*[ \t]*"
+ "^[ \t]*\\([Rr][Ee]\\(\\[[0-9]*\\]\\)* ?:[ \t]*\\)*[ \t]*"
"*Regexp matching \"Re: \" in the subject line."
:group 'message-various
:link '(custom-manual "(message)Message Headers")
--
2.5.0
Eric Abrahamsen
2015-08-16 03:52:02 UTC
Permalink
Post by Peter Münster
Post by Paul van der Walt
Of course, i could understand if such cultural (non-anglophone?) cruft
were undesirable in the Gnus code base, but perhaps others might benefit
from this.
It's useful and I don't see any problem with that patch. Perhaps you
should repost it with a subject like "[PATCH] ..." or do M-x gnus-bug.
But this is already a customization option, shouldn't we just let users
customize it? Is this one tweak worth it?

Steinar Bang
2015-08-15 19:21:45 UTC
Permalink
Post by Paul van der Walt
I recently ran into an issue where a French speaker i was communicating
with had "Re : ..." as their reply subject prefix (note the leading
space before the colon). This quickly ended up with us bouncing emails
around with such lovely subject lines as "Re: Re : Re: Re : Re: ...", et
cetera, ad infinitum. This phenomenon, of surrounding certain
punctuation marks with extra spaces, turns out to be A Thing™ in French
writing [0]. I discovered that by making a very small modification to
the term `message-subject-re-regexp`, the problem was solved for me,
locally (it's in my configuration files ATM). But since this might be
something that's useful to others, i threw a patch together, attached.
On a side note I have solved this outside of Gnus in procmail with this in my
.procmailrc:

#
# Fix Subject RE/SV/AW line for MSExchange/MSMail/MSOutlook
# Also fix Subject field for Norwegian android mailer ("Vedr").
# No X-Mailer field to rely on, unfortunately!
# Remove MSE quotes of type "'Real Name'"
#
:0 fhw
| /usr/bin/perl -ne "s/\?[Ww]indows-1252\?/?iso-8859-1?/g; s/^(Subject:)\s+(S[Vv]:\s*|AW:\s*|Ad:\s*|Vedr:\s*|R[eE](\(\d+\))?:\s*)+/\1 Re: /g;s/^(Subject:)\s+(=\?((iso|ISO)-8859-1|us-ascii)\?Q\?)((S[Vv]|AW|Ad|R[eE](\(\d+\))?)(:|=3[Aa])_*)+/\1 \2Re:_/g; s/\042\'([^\']*)\'\042/\042\1\042/g ; print"

As this regular expression shows there seems to be a great deal of
creativity when it comes to messing up subject headers. Everything
matched here has been encountered in the wild.
Loading...