From c77b16ddb7317932d0bbb9b62286ead51e772d5f Mon Sep 17 00:00:00 2001 From: okazaki Date: Tue, 16 Feb 2010 05:04:45 +0000 Subject: [PATCH] (wl-summary-test-spam): Call `wl-summary-unmark-spam' for the message not classified as spam. (wl-summary-test-spam-messages): New function. (wl-summary-test-spam-region): Use `wl-summary-test-spam-messages' instead of `wl-spam-map-spam-messages'. --- doc/wl-ja.texi | 5 +++-- doc/wl.texi | 6 ++++-- wl/ChangeLog | 8 ++++++++ wl/wl-spam.el | 27 ++++++++++++++++++++------- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/doc/wl-ja.texi b/doc/wl-ja.texi index 6f728fa..0c140f4 100644 --- a/doc/wl-ja.texi +++ b/doc/wl-ja.texi @@ -7100,7 +7100,7 @@ non-spam としての学習に加えて、spam に行なった学習を削除します。 @kindex k c (Summary) @findex wl-summary-test-spam カーソル行のメッセージをテストし、spam と判定された場合に spam マークを -付けます。 +付けます。spam でないと判定された場合は spam マークを取り除きます。 @item k C @kindex k C (Summary) @@ -7139,7 +7139,7 @@ spam かどうかのテストを行います。spam と判定されたメッセージには、sp @kindex r k c (Summary) @findex wl-summary-test-spam-region 指定リージョンにあるメッセージをテストし、spam と判定された場合に spam マークを -付けます。 +付けます。spam でないと判定された場合は spam マークを取り除きます。 @item t k m @kindex t k m (Summary) @@ -7153,6 +7153,7 @@ prefix argument つきならばカーソル行があるメッセージを含むスレッド全てに @findex wl-thread-test-spam カーソル行があるメッセージを先頭とするスレッドのメッセージをテストし、 spam と判定された場合に spam マークを付けます。 +spam でないと判定された場合は spam マークを取り除きます。 prefix argument つきならばカーソル行があるメッセージを含むスレッド全てに 適用します。 diff --git a/doc/wl.texi b/doc/wl.texi index e09414c..f2517c2 100644 --- a/doc/wl.texi +++ b/doc/wl.texi @@ -7158,6 +7158,7 @@ Put spam mark (@samp{s}) on current message. @kindex k c (Summary) @findex wl-summary-test-spam Test current message and put spam mark if judged as spam. +Remove spam mark if judged as non-spam. @item k C @kindex k C (Summary) @@ -7195,6 +7196,7 @@ Put spam mark on messages in the specified region. @kindex r k c (Summary) @findex wl-summary-test-spam-region Test messages in the specified region and put spam mark if judged as spam. +Remove spam mark if judged as non-spam. @item t k m @kindex t k m (Summary) @@ -7206,8 +7208,8 @@ With prefix argument, it affects on the all messages in the thread tree. @kindex t k c (Summary) @findex wl-thread-test-spam Test messages which are the descendant of the current thread and put spam mark -if judged as spam. With prefix argument, it affects on the all messages in -the thread tree. +if judged as spam. Remove spam mark if judged as non-spam. +With prefix argument, it affects on the all messages in the thread tree. @item m k @kindex m k (Summary) diff --git a/wl/ChangeLog b/wl/ChangeLog index 7ece384..23a38c1 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,11 @@ +2010-02-16 Tetsurou Okazaki + + * wl-spam.el (wl-summary-test-spam): Call `wl-summary-unmark-spam' + for the message not classified as spam. + (wl-summary-test-spam-messages): New function. + (wl-summary-test-spam-region): Use `wl-summary-test-spam-messages' + instead of `wl-spam-map-spam-messages'. + 2010-02-08 Tetsurou Okazaki * wl-action.el (wl-summary-action-unmark-docstring): New inline function. diff --git a/wl/wl-spam.el b/wl/wl-spam.el index 8c94de0..2464ac4 100644 --- a/wl/wl-spam.el +++ b/wl/wl-spam.el @@ -206,7 +206,8 @@ See `wl-summary-mark-action-list' for the detail of element." (eval-when-compile ;; Avoid compile warnings - (defalias-maybe 'wl-summary-spam 'ignore)) + (defalias-maybe 'wl-summary-spam 'ignore) + (defalias-maybe 'wl-summary-unmark-spam 'ignore)) (defun wl-summary-test-spam (&optional folder number) (interactive) @@ -214,20 +215,32 @@ See `wl-summary-mark-action-list' for the detail of element." (number (or number (wl-summary-message-number))) spam) (message "Checking spam...") - (when (setq spam (elmo-spam-message-spam-p (elmo-spam-processor) - folder number)) - (wl-summary-spam number)) + (if (setq spam (elmo-spam-message-spam-p (elmo-spam-processor) + folder number)) + (wl-summary-spam number) + (wl-summary-unmark-spam number)) (message "Checking spam...done") (when (interactive-p) (message "No: %d is %sa spam message." number (if spam "" "not "))))) +(defun wl-summary-test-spam-messages (folder numbers &rest args) + (elmo-with-progress-display (elmo-spam-check-spam (length numbers)) + "Checking spam" + (let* ((spams (elmo-spam-list-spam-messages (elmo-spam-processor) + folder + numbers)) + (goods (car (elmo-list-diff numbers spams)))) + (dolist (number spams) + (wl-summary-spam number args)) + (dolist (number goods) + (wl-summary-unmark-spam number))))) + (defun wl-summary-test-spam-region (beg end) (interactive "r") (let ((numbers (wl-summary-collect-numbers-region beg end))) (cond (numbers - (wl-spam-map-spam-messages wl-summary-buffer-elmo-folder - numbers - #'wl-summary-spam)) + (wl-summary-test-spam-messages wl-summary-buffer-elmo-folder + numbers)) ((interactive-p) (message "No message to test."))))) -- 1.7.10.4