Gnus development mailing list
 help / color / mirror / Atom feed
From: David Z Maze <dmaze@MIT.EDU>
Subject: Re: spam.el is a bit aggressive loading/saving spam-stat data
Date: Sat, 01 Mar 2003 08:26:58 -0500	[thread overview]
Message-ID: <y68fzq7tdy5.fsf@multics.mit.edu> (raw)
In-Reply-To: <4nel5u3frk.fsf@chubby.bwh.harvard.edu> (Ted Zlatanov's message of "Wed, 26 Feb 2003 16:15:27 -0500")

[-- Attachment #1: Type: text/plain, Size: 790 bytes --]

Ted Zlatanov <tzz@lifelogs.com> writes:

> On Tue, 25 Feb 2003, dmaze@MIT.EDU wrote:
>> Could you also make the parallel change with spam-stat-load?  It
>> could be added to perhaps gnus-get-new-news-hook, and then removed
>> from spam-split.  (A little tricky; you want to make sure it's
>> loaded when Gnus is first started, but don't want to lose updated
>> data when you rescan groups.)
>
> Oh, I see the problem.  Sorry!  Fixed, I moved spam-stat-load to
> gnus-get-new-news-hook as you suggested.

Well, the good news: Gnus no longer takes multiple seconds per message
to read mail.  :-)  The bad news, part 1, is that this only works if
spam-use-stat is defined before spam.el is loaded.  (So if you
(require 'spam) at the top of your .gnus, say, you lose.)  This patch
fixes that:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: spam.el.diff --]
[-- Type: text/x-patch, Size: 940 bytes --]

Index: spam.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/spam.el,v
retrieving revision 6.77
diff -u -r6.77 spam.el
--- spam.el	28 Feb 2003 21:33:47 -0000	6.77
+++ spam.el	1 Mar 2003 13:40:08 -0000
@@ -810,10 +810,15 @@
 	       (insert article-string)
 	       (spam-stat-buffer-is-non-spam))))))
 
+      (defun spam-maybe-spam-stat-load ()
+	(if spam-use-stat (spam-stat-load)))
+
+      (defun spam-maybe-spam-stat-save ()
+	(if spam-use-stat (spam-stat-save)))
+
       ;; Add hooks for loading and saving the spam stats
-      (when spam-use-stat
-	(add-hook 'gnus-save-newsrc-hook 'spam-stat-save)
-	(add-hook 'gnus-get-new-news-hook 'spam-stat-load)))
+      (add-hook 'gnus-save-newsrc-hook 'spam-maybe-spam-stat-save)
+      (add-hook 'gnus-get-new-news-hook 'spam-maybe-spam-stat-load))
 
   (file-error (progn
 		(defalias 'spam-stat-register-ham-routine 'ignore)

[-- Attachment #3: Type: text/plain, Size: 574 bytes --]


Even with that, spam-stat-load doesn't seem to get called when Gnus is
loaded.  What in gnus-1 causes incoming mail to be read on startup?
The only call to gnus-group-get-new-news there is protected by a call
to gnus-alive-p, and the code seems to leap from reading in all of the
prerequisite files to building the group buffer.  Does something in
the startup sequence actually run gnus-get-new-news-hook?

-- 
David Maze             dmaze@mit.edu          http://www.mit.edu/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell

  reply	other threads:[~2003-03-01 13:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-20 18:22 David Z Maze
2003-02-21  8:16 ` Niklas Morberg
2003-02-21 15:14 ` Ted Zlatanov
2003-02-21 20:25   ` David Z Maze
2003-02-21 20:49     ` Ted Zlatanov
2003-02-21 21:06       ` David Z Maze
2003-02-21 23:58       ` Alex Schroeder
2003-02-24 21:53         ` Ted Zlatanov
2003-02-26  2:23           ` David Z Maze
2003-02-26 21:15             ` Ted Zlatanov
2003-03-01 13:26               ` David Z Maze [this message]
2003-03-01 15:08                 ` Ted Zlatanov
2003-03-02 23:49                   ` David Z Maze
2003-03-06 13:22                     ` Niklas Morberg
2003-03-06 15:39                       ` Ted Zlatanov
2003-03-07 14:27                         ` Bill White
2003-03-07 14:38                           ` Niklas Morberg
2003-03-07 15:13                             ` Bill White
2003-03-10  8:05                               ` Niklas Morberg
2003-03-11 12:53                                 ` Bill White
2003-03-07 14:55                           ` Ted Zlatanov
2003-03-07 22:55                             ` A.J. Rossini
2003-03-08  0:49                               ` Alex Schroeder

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=y68fzq7tdy5.fsf@multics.mit.edu \
    --to=dmaze@mit.edu \
    /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).