From: Eli Zaretskii Date: Sat, 8 Jan 2022 14:32:01 +0000 (+0200) Subject: Fix Subject "simplification" in Rmail X-Git-Tag: emacs-28.0.92~123 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c54fda643d;p=emacs.git Fix Subject "simplification" in Rmail * lisp/mail/rmail.el (rmail-simplified-subject): Match against "[external]" _after_ decoding the Subject by RFC-2047. --- diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index c598e67dab8..49eaeb560e0 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -3356,12 +3356,12 @@ removing prefixes such as Re:, Fwd: and so on and mailing list tags such as [tag]." (let ((subject (or (rmail-get-header "Subject" msgnum) "")) (regexp "\\`[ \t\n]*\\(\\(\\w\\{1,4\\}\u00a0*[::]\\|\\[[^]]+]\\)[ \t\n]+\\)*")) + (setq subject (rfc2047-decode-string subject)) ;; Corporate mailing systems sometimes add `[External] :'; if that happened, ;; delete everything up thru there. Empirically, that deletion makes ;; the Subject match the other messages in the thread. (if (string-match "\\[external][ \t\n]*:" subject) (setq subject (substring subject (match-end 0)))) - (setq subject (rfc2047-decode-string subject)) (setq subject (replace-regexp-in-string regexp "" subject)) (replace-regexp-in-string "[ \t\n]+" " " subject)))