bsfilter のインストール
# aptitude install bsfilter
spam の学習
$ bsfilter --add-clean $HOME/Mail/inbox/*
$ bsfilter --add-spam $HOME/Mail/spam/*
$ bsfilter --update
.emacs の編集
mua/mew4/emacs.el を $HOME/.emacs に追加(setq mew-spam: "X-Spam-Flag:")
.mew.el の編集
mua/mew4/mew.el を $HOME/.mew.el に追加; put "D"
(defun mew-spam-bsfilter (val)
(let ((case-fold-search t))
(if (string-match "yes" val) ?D)))
; put "o +spam" at inc
;(defun mew-spam-bsfilter (val)
; (let ((case-fold-search t))
; (if (string-match "yes" val) "+spam")))
(setq mew-inbox-action-alist
'(("X-Spam-Flag:" mew-spam-bsfilter)))
; for "ls" (learn-spam)
(setq mew-spam-prog "bsfilter")
(setq mew-spam-prog-args '("-C" "-s" "-u"))
; for "lh" (learn-ham)
(setq mew-ham-prog "bsfilter")
(setq mew-ham-prog-args '("-c" "-S" "-u"))
; for "bm" (mark-spam)
(define-key mew-summary-mode-map "bm" 'mew-summary-bsfilter-mark-region)
(defun mew-summary-bsfilter-mark-region (&optional arg)
"study/judge the region and put the '*' mark onto spams.
need to re-learn if judgment of bsfilter is wrong"
(interactive "P")
(mew-pickable
(let ((func 'mew-summary-pick-with-cmd)
(mew-inherit-grep-cmd "bsfilter -a --list-spam"))
(mew-summary-pick-body func t nil 'nopattern))))
; show X-Spam-Flag and X-Spam-Probability in message buffer
(setq mew-field-spec
(reverse (append (list (car (reverse mew-field-spec)))
'(("^X-Spam-Probability:$" t)
("^X-Spam-Flag:$" t))
(cdr (reverse mew-field-spec)))))
Reference
bsfilter - bsfilter with mewhttp://bsfilter.org/mew.html
Debian パッケージディレクトリ検索 (バイナリ) - bsfilter