;;; wl-score.el -- Scoring in Wanderlust.
-;; Copyright 1998,1999,2000 Masahiro MURATA <muse@ba2.so-net.ne.jp>
-;; Yuuichi Teranishi <teranisi@gohome.org>
+;; Copyright (C) 1998,1999,2000 Masahiro MURATA <muse@ba2.so-net.ne.jp>
+;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
;; Author: Masahiro MURATA <muse@ba2.so-net.ne.jp>
;; Keywords: mail, net news
It is assumed to be a single-line subject.
Whitespace is generally cleaned up, and miscellaneous leading/trailing
matter is removed. Additional things can be deleted by setting
-wl-score-simplify-fuzzy-regexp."
+`wl-score-simplify-fuzzy-regexp'."
(let ((regexp
(if (listp wl-score-simplify-fuzzy-regexp)
(mapconcat (function identity) wl-score-simplify-fuzzy-regexp
(elmo-buffer-replace "^ +")))
(defun wl-score-simplify-string-fuzzy (string)
- "Simplify a string fuzzily.
+ "Simplify a STRING fuzzily.
See `wl-score-simplify-buffer-fuzzy' for details."
(elmo-set-work-buf
(let ((case-fold-search t))
(buffer-string))))
(defun wl-score-simplify-subject (subject)
+ "Simplify a SUBJECT fuzzily.
+Remove Re, Was, Fwd etc."
(elmo-set-work-buf
(let ((regexp
(if (listp wl-score-simplify-fuzzy-regexp)
(sort messages func)))
(defsubst wl-score-get (symbol &optional alist)
+ "Get SYMBOL's definition in ALIST."
;; Get SYMBOL's definition in ALIST.
(cdr (assoc symbol
(or alist
wl-score-alist))))
(defun wl-score-set (symbol value &optional alist warn)
+ "Set SYMBOL to VALUE in ALIST."
;; Set SYMBOL to VALUE in ALIST.
(let* ((alist (or alist wl-score-alist))
(entry (assoc symbol alist)))
(cons (cons symbol value) (cdr alist)))))))
(defun wl-score-cache-clean ()
+ "Cleaning score cache.
+Set `wl-score-cache' nil."
(interactive)
(setq wl-score-cache nil))
(setq wl-score-alist alist)))))))
(defun wl-score-save ()
+ "Save all score information."
;; Save all score information.
(let ((cache wl-score-cache)
entry score file dir)
(setq wl-current-score-file file)
(setq wl-score-alist alist)))
-(defun wl-score-guess-like-gnus (folder)
- (let* (score-list
- (spec (elmo-folder-get-spec folder))
- (method (symbol-name (car spec)))
- (fld-name (elmo-string (car (cdr spec)))))
- (when (stringp fld-name)
- (while (string-match "[\\/:,;*?\"<>|]" fld-name)
- (setq fld-name (replace-match "." t nil fld-name)))
- (setq score-list (list (concat method "@" fld-name ".SCORE")))
- (while (string-match "[\\/.][^\\/.]*$" fld-name)
- (setq fld-name (substring fld-name 0 (match-beginning 0)))
- (wl-append score-list (list (concat method "@" fld-name
- ".all.SCORE"))))
- score-list)))
-
(defun wl-score-get-score-files (score-alist folder)
(let ((files (wl-get-assoc-list-value
score-alist folder
fl
(cond ((functionp f)
(funcall f folder))
- ((and (symbolp f) (eq f 'guess))
- (wl-score-guess-like-gnus folder))
(t
(list f)))))
fl))
(let ((mark (car (wl-score-get 'mark alist)))
(expunge (car (wl-score-get 'expunge alist)))
(mark-and-expunge (car (wl-score-get 'mark-and-expunge alist)))
- (temp (car (wl-score-get 'temp alist))) ; obsolate
(target (car (wl-score-get 'target alist)))
(important (car (wl-score-get 'important alist))))
(setq wl-summary-important-above
(or important wl-summary-important-above))
(setq wl-summary-target-above
- (or target temp wl-summary-target-above))
+ (or target wl-summary-target-above))
(setq wl-summary-mark-below
(or mark mark-and-expunge wl-summary-mark-below))
(setq wl-summary-expunge-below
(eword-decode-region (point-min) (point-max))))))))
(defun wl-score-string (scores header now expire &optional extra-header)
+ "Insert the unique message headers in the buffer."
;; Insert the unique message headers in the buffer.
(let ((wl-score-index (nth 2 (assoc header wl-score-header-index)))
entries alist messages
(and (eolp)
(= (save-excursion (forward-line 0) (point))
(match-beginning 0))))
- ;;(end-of-line)
+;;; (end-of-line)
(setq found (setq arts (wl-score-get-alike)))
;; Found a match, update scores.
(while (setq art (pop arts))
(wl-score-followup scores header now expire t))
(defun wl-score-followup (scores header now expire &optional thread)
+ "Insert the unique message headers in the buffer."
;; Insert the unique message headers in the buffer.
(let ((wl-score-index (nth 2 (assoc header wl-score-header-index)))
(all-scores scores)
(and (eolp)
(= (progn (beginning-of-line) (point))
(match-beginning 0))))
- ;;(end-of-line)
+;;; (end-of-line)
(setq found (setq arts (wl-score-get-alike)))
;; Found a match, update scores.
(while (setq art (pop arts))
mark-alist)
(length num-db)))
(wl-summary-update-modeline)))
- (message "Updating score...done.")
+ (message "Updating score...done")
dels)))
(defun wl-score-edit-done ()
(call-interactively 'wl-score-edit-file)))
(defun wl-score-edit-file (file)
- "Edit a score file."
+ "Edit a score FILE."
(interactive
(list (read-file-name "Edit score file: " wl-score-files-dir)))
(when (wl-collect-summary)