[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#29659: 25.2; better rmail-summary-by-topic
From: |
Francesco Potortì |
Subject: |
bug#29659: 25.2; better rmail-summary-by-topic |
Date: |
Tue, 12 Dec 2017 18:49:20 +0100 |
This is my current attempt, seems to work, please give it a try.
(defun rmail-simplified-subject (&optional msgnum)
"Return the simplified subject of message MSGNUM (or current message).
Simplifying the subject means stripping leading and trailing
whitespace, replacing whitespace runs with a single space and
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,3\\}:\\|\\[[^]]+]\\)[ \t\n]+\\)*"))
(setq subject (rfc2047-decode-string subject))
(setq subject (replace-regexp-in-string regexp "" subject))
(replace-regexp-in-string "[ \t\n]+" " " subject)))