From ef0ad7c3c40d8fab2bdccdd4476caf341325a7b7 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Thu, 26 Feb 2004 21:55:59 +0000 Subject: [PATCH] Synch to No Gnus 200402262139. --- lisp/ChangeLog | 20 ++++++++++++++++++++ lisp/nnrss.el | 43 ++++++++++++++++++++++++++++++++++++++++++- lisp/spam-stat.el | 47 ++++++++++++++++++++++++++++------------------- lisp/spam.el | 7 ++++++- 4 files changed, 96 insertions(+), 21 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 33450e4..e13db9f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,23 @@ +2004-02-26 Mark A. Hershberger + + * nnrss.el (nnrss-opml-import, nnrss-opml-export): New functions. + +2004-02-26 Teodor Zlatanov + + * spam.el (spam-summary-prepare-exit): gnus-set-difference needs + to be run with new-articles as LIST1, not LIST2 + (spam-registration-functions): add spam-use-ham-copy as a nil + registration backend + +2004-02-26 Jesper Harder + + * spam-stat.el (spam-stat-washing-hook): New option. + (spam-stat-buffer-words): Use it. + (spam-stat-process-directory, spam-stat-test-directory): Use + insert-file-contents-literally. + (spam-stat-coding-system): New variable. + (spam-stat-load, spam-stat-save): Use it. + 2004-02-25 Katsumi Yamaoka * spam-report.el (spam-report-plug-agent): Quote diff --git a/lisp/nnrss.el b/lisp/nnrss.el index 5613481..6416a81 100644 --- a/lisp/nnrss.el +++ b/lisp/nnrss.el @@ -1,5 +1,5 @@ ;;; nnrss.el --- interfacing with RSS -;; Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +;; Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. ;; Author: Shenghuo Zhu ;; Keywords: RSS @@ -453,6 +453,47 @@ ARTICLE is the article number of the current headline.") (push (list group nnrss-group-max) nnrss-server-data))) (nnrss-save-server-data server)))) +(defun nnrss-opml-import (opml-file) + "OPML subscriptions import. +Read the file and attempt to subscribe to each Feed in the file." + (interactive "fImport file: ") + (mapcar + (lambda (node) (gnus-group-make-rss-group + (cdr (assq 'xmlUrl (cadr node))))) + (nnrss-find-el 'outline + (progn + (find-file opml-file) + (xml-parse-region (point-min) + (point-max)))))) + +(defun nnrss-opml-export () + "OPML subscription export. +Export subscriptions to a buffer in OPML Format." + (interactive) + (with-current-buffer (get-buffer-create "*OPML Export*") + (set-buffer-file-coding-system 'utf-8) + (insert (concat + "\n" + "\n" + "\n" + " \n" + " mySubscriptions\n" + " " (format-time-string "%a, %d %b %Y %T %z") + "\n" + " " user-mail-address "\n" + " " (user-full-name) "\n" + " \n" + " \n")) + (mapcar (lambda (sub) + (insert (concat + " \n"))) + nnrss-group-alist) + (insert (concat + " \n" + "\n"))) + (pop-to-buffer "*OPML Export*")) + (defun nnrss-generate-download-script () "Generate a download script in the current buffer. It is useful when `(setq nnrss-use-local t)'." diff --git a/lisp/spam-stat.el b/lisp/spam-stat.el index 958e68f..2b0d21e 100644 --- a/lisp/spam-stat.el +++ b/lisp/spam-stat.el @@ -172,6 +172,11 @@ effect when spam-stat is invoked through spam.el." :type 'number :group 'spam-stat) +(defcustom spam-stat-washing-hook nil + "Hook applied to each message before analysis." + :type 'hook + :group 'spam-stat) + (defcustom spam-stat-process-directory-age 90 "Max. age of files to be processed in directory, in days. When using `spam-stat-process-spam-directory' or @@ -202,6 +207,10 @@ This is set by hooking into Gnus.") (defvar spam-stat-buffer-name " *spam stat buffer*" "Name of the `spam-stat-buffer'.") +(defvar spam-stat-coding-system + (if (coding-system-p 'emacs-mule) 'emacs-mule 'raw-text) + "Coding system used for `spam-stat-file'.") + ;; Hooking into Gnus (defun spam-stat-store-current-buffer () @@ -298,6 +307,7 @@ Use `spam-stat-ngood', `spam-stat-nbad', `spam-stat-good', (defun spam-stat-buffer-words () "Return a hash table of words and number of occurences in the buffer." + (run-hooks 'spam-stat-washing-hook) (with-spam-stat-max-buffer-size (with-syntax-table spam-stat-syntax-table (goto-char (point-min)) @@ -377,27 +387,26 @@ Use `spam-stat-ngood', `spam-stat-nbad', `spam-stat-good', With a prefix argument save unconditionally." (interactive "P") (when (or force spam-stat-dirty) - (with-temp-buffer - (let ((standard-output (current-buffer)) - (font-lock-maximum-size 0)) - (insert "(setq spam-stat-ngood " - (number-to-string spam-stat-ngood) - " spam-stat-nbad " - (number-to-string spam-stat-nbad) - " spam-stat (spam-stat-to-hash-table '(") - (maphash (lambda (word entry) - (prin1 (list word - (spam-stat-good entry) - (spam-stat-bad entry)))) - spam-stat) - (insert ")))") - (write-file spam-stat-file))) - (setq spam-stat-dirty nil))) + (let ((coding-system-for-write spam-stat-coding-system)) + (with-temp-file spam-stat-file + (let ((standard-output (current-buffer)) + (font-lock-maximum-size 0)) + (insert (format ";-*- coding: %s; -*-\n" spam-stat-coding-system)) + (insert (format "(setq spam-stat-ngood %d spam-stat-nbad %d +spam-stat (spam-stat-to-hash-table '(" spam-stat-ngood spam-stat-nbad)) + (maphash (lambda (word entry) + (prin1 (list word + (spam-stat-good entry) + (spam-stat-bad entry)))) + spam-stat) + (insert ")))")))) + (setq spam-stat-dirty nil))) (defun spam-stat-load () "Read the `spam-stat' hash table from disk." ;; TODO: maybe we should warn the user if spam-stat-dirty is t? - (load-file spam-stat-file) + (let ((coding-system-for-read spam-stat-coding-system)) + (load-file spam-stat-file)) (setq spam-stat-dirty nil)) (defun spam-stat-to-hash-table (entries) @@ -500,7 +509,7 @@ check the variable `spam-stat-score-data'." spam-stat-process-directory-age)) (setq count (1+ count)) (message "Reading %s: %.2f%%" dir (/ count max)) - (insert-file-contents f) + (insert-file-contents-literally f) (spam-stat-strip-xref) (funcall func) (erase-buffer)))))) @@ -545,7 +554,7 @@ display non-spam files; otherwise display spam files." (setq count (1+ count)) (message "Reading %.2f%%, score %.2f" (/ count max) (/ score count)) - (insert-file-contents f) + (insert-file-contents-literally f) (setq buffer-score (spam-stat-score-buffer)) (when (> buffer-score 0.9) (setq score (1+ score))) diff --git a/lisp/spam.el b/lisp/spam.el index 2dec99b..aa4ff13 100644 --- a/lisp/spam.el +++ b/lisp/spam.el @@ -699,7 +699,7 @@ Respects the process/prefix convention." (new-articles (spam-list-articles gnus-newsgroup-articles classification)) - (changed-articles (gnus-set-difference old-articles new-articles))) + (changed-articles (gnus-set-difference new-articles old-articles))) ;; now that we have the changed articles, we go through the processors (dolist (processor-param spam-list-of-processors) (let ((processor (nth 0 processor-param)) @@ -1142,6 +1142,10 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." nil spam-whitelist-unregister-routine nil) + (spam-use-ham-copy nil + nil + nil + nil) (spam-use-BBDB spam-BBDB-register-routine nil spam-BBDB-unregister-routine @@ -1314,6 +1318,7 @@ functions") nil decision))) + ;;; check if a ham- or spam-processor registration needs to be undone (defun spam-log-unregistration-needed-p (id type classification check) (when spam-log-to-registry -- 1.7.10.4