diff options
author | Eli Zaretskii <eliz@gnu.org> | 2005-12-10 11:30:33 +0000 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2005-12-10 11:30:33 +0000 |
commit | 7c86d70e27dd91222d2894e18524086d4ad7dee9 (patch) | |
tree | 964797bbffd3a00b4c1c500cbdd4d2faaa52c2e3 /lisp/mail | |
parent | d9f9aa720f0bb1ebfb3fd9e9e678da25c7bbf271 (diff) | |
download | emacs-7c86d70e27dd91222d2894e18524086d4ad7dee9.tar.gz |
(rmail-next-same-subject): Handle multiple "Re: " strings and long subject
lines that were broken into multiple lines at arbitrary places.
Diffstat (limited to 'lisp/mail')
-rw-r--r-- | lisp/mail/rmail.el | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 0decf2813aa..b45467386ba 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -3155,13 +3155,18 @@ If N is negative, go backwards instead." search-regexp found) (if (string-match "\\`[ \t]+" subject) (setq subject (substring subject (match-end 0)))) - (if (string-match "Re:[ \t]*" subject) + (if (string-match "\\`\\(Re:[ \t]*\\)+" subject) (setq subject (substring subject (match-end 0)))) (if (string-match "[ \t]+\\'" subject) (setq subject (substring subject 0 (match-beginning 0)))) - (setq search-regexp (concat "^Subject: *\\(Re:[ \t]*\\)?" - (regexp-quote subject) - "[ \t]*\n")) + ;; If Subject is long, mailers will break it into several lines at + ;; arbitrary places, so replace whitespace with a regexp that will + ;; match any sequence of spaces, TABs, and newlines. + (setq subject (regexp-quote subject)) + (setq subject + (replace-regexp-in-string "[ \t\n]+" "[ \t\n]+" subject t t)) + (setq search-regexp (concat "^Subject: *\\(Re:[ \t]*\\)*" + subject "[ \t]*\n")) (save-excursion (save-restriction (widen) |