1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00

Fix Subject "simplification" in Rmail

* lisp/mail/rmail.el (rmail-simplified-subject): Match against
"[external]" _after_ decoding the Subject by RFC-2047.
This commit is contained in:
Eli Zaretskii 2022-01-08 16:32:01 +02:00
parent d193801f59
commit c54fda643d

View File

@ -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)))