From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/50466 Path: main.gmane.org!not-for-mail From: David Z Maze Newsgroups: gmane.emacs.gnus.general Subject: Re: spam.el is a bit aggressive loading/saving spam-stat data Date: Sat, 01 Mar 2003 08:26:58 -0500 Sender: owner-ding@hpc.uh.edu Message-ID: References: <4nd6ll3bus.fsf@lockgroove.bwh.harvard.edu> <4nk7ft1hqj.fsf@lockgroove.bwh.harvard.edu> <874r6xtccq.fsf@emacswiki.org> <4nisv91h2t.fsf@chubby.bwh.harvard.edu> <4nel5u3frk.fsf@chubby.bwh.harvard.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1046525301 24675 80.91.224.249 (1 Mar 2003 13:28:21 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 1 Mar 2003 13:28:21 +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 18p72I-0006Pl-00 for ; Sat, 01 Mar 2003 14:28:18 +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 18p71M-000204-00; Sat, 01 Mar 2003 07:27:20 -0600 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Sat, 01 Mar 2003 07:28:19 -0600 (CST) Original-Received: from sclp3.sclp.com (sclp3.sclp.com [66.230.238.2]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id HAA22194 for ; Sat, 1 Mar 2003 07:28:05 -0600 (CST) Original-Received: (qmail 99364 invoked by alias); 1 Mar 2003 13:27:01 -0000 Original-Received: (qmail 99358 invoked from network); 1 Mar 2003 13:27:01 -0000 Original-Received: from pacific-carrier-annex.mit.edu (18.7.21.83) by 66.230.238.6 with SMTP; 1 Mar 2003 13:27:01 -0000 Original-Received: from grand-central-station.mit.edu (GRAND-CENTRAL-STATION.MIT.EDU [18.7.21.82]) by pacific-carrier-annex.mit.edu (8.9.2/8.9.2) with ESMTP id IAA15580 for ; Sat, 1 Mar 2003 08:26:59 -0500 (EST) Original-Received: from melbourne-city-street.mit.edu (MELBOURNE-CITY-STREET.MIT.EDU [18.7.21.86]) by grand-central-station.mit.edu (8.9.2/8.9.2) with ESMTP id IAA17096; Sat, 1 Mar 2003 08:26:59 -0500 (EST) Original-Received: from multics.mit.edu (MULTICS.MIT.EDU [18.187.1.73]) by melbourne-city-street.mit.edu (8.9.2/8.9.2) with ESMTP id IAA23132; Sat, 1 Mar 2003 08:26:58 -0500 (EST) Original-To: ding@gnus.org In-Reply-To: <4nel5u3frk.fsf@chubby.bwh.harvard.edu> (Ted Zlatanov's message of "Wed, 26 Feb 2003 16:15:27 -0500") User-Agent: Gnus/5.090016 (Oort Gnus v0.16) XEmacs/21.4 (Artificial Intelligence, sparc-sun-solaris2.8) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:50466 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:50466 --=-=-= Ted Zlatanov 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: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=spam.el.diff 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) --=-=-= 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 --=-=-=--