- (function
- (lambda (msg)
- (let ((n 0))
- (while (and (< n (length labelvec))
- (not (rmail-message-labels-p
- msg (aref labelvec n))))
- (setq n (1+ n)))
- n))))))
+ ;; If no labels match, returns nmax; if they
+ ;; match the first specified in LABELS,
+ ;; returns 0; if they match the second, returns 1; etc.
+ ;; Hence sorts as described in the doc-string.
+ (lambda (msg)
+ (let ((n 0)
+ (str (concat (rmail-get-attr-names msg)
+ ", "
+ (rmail-get-keywords msg))))
+ ;; No labels: can't match anything.
+ (if (string-equal ", " str)
+ nmax
+ (while (and (< n nmax)
+ (not (string-match (aref labelvec n)
+ str)))
+ (setq n (1+ n)))
+ n))))))