Function: mh-thread-prune-subject
mh-thread-prune-subject is a byte-compiled function defined in
mh-thread.el.gz.
Signature
(mh-thread-prune-subject SUBJECT)
Documentation
Prune leading Re:'s, Fwd:'s etc. and trailing (fwd)'s from SUBJECT.
If the result after pruning is not the empty string then it is canonicalized so that subjects can be tested for equality with eq. This is done so that all the messages without a subject are not put into a single thread.
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-thread.el.gz
(defsubst mh-thread-prune-subject (subject)
"Prune leading Re:'s, Fwd:'s etc. and trailing (fwd)'s from SUBJECT.
If the result after pruning is not the empty string then it is
canonicalized so that subjects can be tested for equality with
eq. This is done so that all the messages without a subject are
not put into a single thread."
(let ((case-fold-search t)
(subject-pruned-flag nil))
;; Prune subject leader
(while (or (string-match "^[ \t]*\\(re\\|fwd?\\)\\(\\[[0-9]*\\]\\)?:[ \t]*"
subject)
(string-match "^[ \t]*\\[[^\\]][ \t]*" subject))
(setq subject-pruned-flag t)
(setq subject (substring subject (match-end 0))))
;; Prune subject trailer
(while (or (string-match "(fwd)$" subject)
(string-match "[ \t]+$" subject))
(setq subject-pruned-flag t)
(setq subject (substring subject 0 (match-beginning 0))))
;; Canonicalize subject only if it is non-empty
(cond ((equal subject "") (list subject subject-pruned-flag))
(t (list
(or (gethash subject mh-thread-subject-hash)
(setf (gethash subject mh-thread-subject-hash) subject))
subject-pruned-flag)))))