Gnus development mailing list
 help / color / mirror / Atom feed
From: Michael Shields <shields@msrl.com>
Subject: [PATCH] Simplify and correct header trimming before feeding to bogofilter
Date: Tue, 31 Dec 2002 06:35:46 +0000	[thread overview]
Message-ID: <87y966hf0d.fsf@mulligatwani.msrl.com> (raw)

I sent this patch a few days ago, but mail.gnus.org ate it.

2002-12-19  Michael Shields  <shields@msrl.com>
	
	* 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.




             reply	other threads:[~2002-12-31  6:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-31  6:35 Michael Shields [this message]
2002-12-31 12:30 ` Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y966hf0d.fsf@mulligatwani.msrl.com \
    --to=shields@msrl.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).