bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29659: Fwd: Re: bug#29659: 25.2; better rmail-summary-by-topic


From: Francesco Potortì
Subject: bug#29659: Fwd: Re: bug#29659: 25.2; better rmail-summary-by-topic
Date: Wed, 24 Jan 2018 13:00:59 +0100

(resending after reopening the bug)

There is an obvious error in the following code, which for some reason
did work for me but works no more after an Emacs restart.

The regexp variable should start with a double backslash:
        (regexp "\\`[ \t\n]*\\(\\(\\w\\{1,3\\}:\\|\\[[^]]+]\\)[ \t\n]+\\)*"))

rather than
        (regexp "\`[ \t\n]*\\(\\(\\w\\{1,3\\}:\\|\\[[^]]+]\\)[ \t\n]+\\)*"))


------- Start of forwarded message -------
From: "Francesco Potortì" <pot@gnu.org>
Date: Tue, 12 Dec 2017 18:49:20 +0100
To: Eli Zaretskii <eliz@gnu.org>
CC: 29659@debbugs.gnu.org
In-reply-to: <83o9n5rvco.fsf@gnu.org> (eliz@gnu.org)
Subject: Re: bug#29659: 25.2; better rmail-summary-by-topic

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)))
------- End of forwarded message -------





reply via email to

[Prev in Thread] Current Thread [Next in Thread]