From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/48432 Path: main.gmane.org!not-for-mail From: Michael Shields Newsgroups: gmane.emacs.gnus.general Subject: [PATCH] Simplify and correct header trimming before feeding to bogofilter Date: Tue, 31 Dec 2002 06:35:46 +0000 Organization: Mad Science Research Labs Sender: owner-ding@hpc.uh.edu Message-ID: <87y966hf0d.fsf@mulligatwani.msrl.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1041316592 11866 80.91.224.249 (31 Dec 2002 06:36:32 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 31 Dec 2002 06:36:32 +0000 (UTC) Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18TG0t-00035G-00 for ; Tue, 31 Dec 2002 07:36:31 +0100 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 18TG0W-0005Br-00; Tue, 31 Dec 2002 00:36:08 -0600 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Tue, 31 Dec 2002 00:37:01 -0600 (CST) Original-Received: from challah.msrl.com (challah.msrl.com [198.137.194.222]) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id AAA16073 for ; Tue, 31 Dec 2002 00:36:52 -0600 (CST) Original-Received: (qmail 4728 invoked from network); 31 Dec 2002 06:35:47 -0000 Original-Received: from localhost (HELO mulligatwani.msrl.com) (127.0.0.1) by localhost with SMTP; 31 Dec 2002 06:35:47 -0000 Original-To: ding@hpc.uh.edu Original-Lines: 31 User-Agent: Gnus/5.090008 (Oort Gnus v0.08) XEmacs/21.4 (Military Intelligence, i386-debian-linux) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:48432 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:48432 I sent this patch a few days ago, but mail.gnus.org ate it. 2002-12-19 Michael Shields * spam.el (spam-bogofilter-articles): Use message-remove-header to remove headers; the old way incorrectly removed just the first line of folded headers. --- /home/shields/gnus-CURRENT-20021216/lisp/spam.el.orig 2002-12-31 06:34:23.000000000 +0000 +++ /home/shields/gnus-CURRENT-20021216/lisp/spam.el 2002-12-31 06:34:23.000000000 +0000 @@ -530,15 +530,10 @@ (insert-buffer-substring gnus-original-article-buffer) ;; Remove spam classification redundant headers: they may induce ;; unwanted biases in later analysis. - (goto-char (point-min)) - (while (not (or (eobp) (= (following-char) ?\n))) - (if (looking-at remove-regexp) - (delete-region (point) - (save-excursion (forward-line 1) (point))) - (forward-line 1))) - (goto-char (point-min)) + (message-remove-header remove-regexp t) ;; Bogofilter really wants From envelopes for counting articles. ;; Fake one at the beginning, make sure there will be no other. + (goto-char (point-min)) (if (looking-at "From ") (forward-line 1) (insert "From nobody " (current-time-string) "\n")) -- Shields.