カテゴリ : Mew

1ページ目 / 全1ページ

Mew4 + bsfilter

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")
   (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)))))


  bsfilter - bsfilter with mew
Debian パッケージディレクトリ検索 (バイナリ) - bsfilter

Mew 4 系を使用してみる

bsfilter を mew version 4 から使う

Bogofilter, Spamassassin を使う

全部のフォルダの .mew-summary を一気に更新する

(setq mew-touch-folder-p t)
(setq file-writable-p t)

(defun mew-make-cache-all (&optional arg)
  ".mew-cache を一気に作る"
  (interactive "P")
  (let ((fldlst (mapcar 'car mew-local-folder-alist))
    (mew-summary-mode-hook nil)
    (font-lock-mode nil)
    (font-lock-support-mode nil)
    (while (setq fld (car fldlst))
      (condition-case err
      (mew-make-cache arg (directory-file-name fld))
    (error nil))
      (setq fldlst (cdr fldlst))))
  (mew-summary-visit-folder mew-inbox-folder)
  (message "Make .mew-cache done")

(defun mew-make-cache (arg fld)
  (if (or (mew-folder-virtualp fld)
      (and (fboundp 'mew-nmz-skip-folder) (mew-nmz-skip-folder fld))
      (not (mew-dir-messages (mew-expand-folder fld)))
      (and (not arg) (not (mew-make-folder-dir-newp fld))))
      (message "no Make %s" fld)
    (message "Make %s in %s ..." mew-summary-cache-file fld)
    (let ((mew-summary-mode-hook nil)
      (mew-scan-sentinel-hook nil)
      (mew-scan-wait-for 0))
      (mew-summary-visit-folder fld)
      (font-lock-mode -1)
      (while mew-summary-buffer-process
    (sit-for 0.5)
      (message "Make %s in %s ...done" mew-summary-cache-file fld))))

(defun mew-make-folder-dir-newp (fld)
  (let* ((dir (file-chase-links (mew-expand-folder fld)))
     (tdir (if mew-touch-folder-p
            (expand-file-name mew-summary-touch-file
                      (mew-expand-folder dir)))
         (mew-file-get-time dir)))
     (cache (expand-file-name mew-summary-cache-file dir))
     (tcache (mew-file-get-time cache))
     t1 t2)
    (setq t1 tdir)
    (setq t2 tcache)
     ((null t1)
      (if mew-touch-folder-p
      (if (and (file-writable-p (expand-file-name mew-summary-touch-file
                              (mew-expand-folder dir)))
           (mew-dir-messages (mew-expand-folder dir)))
          (progn (mew-touch-folder fld) t)
     ((null t2) t) ;; do update
     ((> (nth 0 t1) (nth 0 t2)) t)
     ((= (nth 0 t1) (nth 0 t2))
      (if (> (nth 1 t1) (nth 1 t2)) t nil)) ;; nil if equal
     (t nil))))

  [mew-dist 21213] Re: mew-summary-ls-all-folders
  Mew Wiki - Mew4FAQ - 全部のフォルダの .mew-summary を一気に更新したい


  Mew Official Homepage
  Mew Wiki
  bsfilter / bayesian spam filter / ベイジアン スパム フィルタ
Debian パッケージディレクトリ検索 (バイナリ) - mew
Debian パッケージディレクトリ検索 (バイナリ) - mew-bin
Debian パッケージディレクトリ検索 (バイナリ) - mew-beta
Debian パッケージディレクトリ検索 (バイナリ) - mew-bin-beta
Debian パッケージディレクトリ検索 (バイナリ) - bsfilter
Debian パッケージディレクトリ検索 (バイナリ) - bogofilter
Debian パッケージディレクトリ検索 (バイナリ) - spamassassin

Mew Tips




C-c C-a