From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/16720 Path: main.gmane.org!not-for-mail From: Mike McEwan Newsgroups: gmane.emacs.gnus.general Subject: [patch] Agent and download scoring etc. Date: 05 Sep 1998 19:02:36 +0100 Sender: owner-ding@hpc.uh.edu Message-ID: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1035155547 29502 80.91.224.250 (20 Oct 2002 23:12:27 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 23:12:27 +0000 (UTC) Return-Path: Original-Received: from gizmo.hpc.uh.edu (gizmo.hpc.uh.edu [129.7.102.31]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id OAA06373 for ; Sat, 5 Sep 1998 14:47:13 -0400 (EDT) Original-Received: from sina.hpc.uh.edu (sina.hpc.uh.edu [129.7.3.5]) by gizmo.hpc.uh.edu (8.7.6/8.7.3) with ESMTP id NAF15681; Sat, 5 Sep 1998 13:18:16 -0500 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Sat, 05 Sep 1998 13:47:04 -0500 (CDT) Original-Received: from sclp3.sclp.com (root@sclp3.sclp.com [209.195.19.139]) by sina.hpc.uh.edu (8.7.3/8.7.3) with ESMTP id NAA12198 for ; Sat, 5 Sep 1998 13:46:53 -0500 (CDT) Original-Received: from post.mail.demon.net (post-20.mail.demon.net [194.217.242.27]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id OAA06365 for ; Sat, 5 Sep 1998 14:46:47 -0400 (EDT) Original-Received: from [158.152.62.156] (helo=lotusland.demon.co.uk) by post.mail.demon.net with smtp (Exim 2.02 #1) id 0zFNM5-000271-00 for ding@gnus.org; Sat, 5 Sep 1998 18:46:38 +0000 Original-Received: from mike by lotusland.demon.co.uk with local (Exim 2.02 #1) id 0zFNM4-0001F9-00 for ding@gnus.org; Sat, 5 Sep 1998 19:46:36 +0100 Original-To: ding@gnus.org X-Mailer: Pterodactyl Gnus v0.14/XEmacs 21.0 - "Finnish Landrace" Original-Lines: 169 Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:16720 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:16720 I've been tinkering again (I wonder what it's like outside?). I tried to get the Agent to download articles based on their scores only to discover (or perhaps rediscover) the Agent way of scoring things is completely separate from normal score files. Lars, I know you're mime, mime, miming at the moment, but since we're alpha again, I wonder if you might whack on the following if you think it looks OK :-). It's the ol' `why can't Agent use my normal score files' patch. The patch allows the Agent to decide what to download with the permitted subset of the normal score files when the download score rule of a category, or locally, the `agent-score' parameter of a group, is `file'. The old stuff still takes precedence. I wasn't sure how category download score rule or group parameter `agent-score' are supposed to be specified and couldn't find any doc so I've made some assumptions: Category rule `file' - use normal score files. `("filename" ["filename"])' - use the specified file(s) (e.g. `("~/News/agent.SCORE")'). `(("from" ("Lars Magne Ingebrigtsen" 1000 nil s))' - use specified rules. Group Parameters `(agent-score . file)' - use normal score files. `(agent-score "filename" ["filename"])' - use the specified file(s). `(agent-score ("from" ("Lars Magne Ingebrigtsen" 1000 nil s)))' - use specified rules. I hope the above doesn't clobber anyone's current usage too much. Group parameters take precedence over category rules. There's a couple of other little mods to try and speed things up a bit. See what you think. -- Mike. --- ChangeLog.orig 1998/09/03 21:23:53 +++ ChangeLog 1998/09/05 16:28:46 @@ -1,3 +1,14 @@ +1998-09-05 Mike McEwan + + * gnus-agent.el (gnus-agent-scoreable-headers): New variable. + (gnus-agent-fetch-group-1): Score article headers using normal + group score files if the download score rule of a category/group + is `file'. + (gnus-agent-fetch-group-1): Don't parse the entire .overview when + deciding what articles to download. + (gnus-agent-fetch-group-1): Don't push headers through scoring and + predicate processing if predicate is `true' or `false'. + Thu Sep 3 15:23:22 1998 Lars Magne Ingebrigtsen * gnus.el: Pterodactyl Gnus v0.14 is released. --- gnus-agent.el.orig Tue Sep 1 20:22:11 1998 +++ gnus-agent.el Sat Sep 5 17:51:29 1998 @@ -27,7 +27,8 @@ (require 'gnus-cache) (require 'nnvirtual) (require 'gnus-sum) -(eval-when-compile (require 'cl)) +(eval-when-compile (require 'cl) + (require 'gnus-score)) (defcustom gnus-agent-directory (nnheader-concat gnus-directory "agent/") "Where the Gnus agent will store its files." @@ -94,6 +95,13 @@ (defvar gnus-agent-send-mail-function nil) (defvar gnus-agent-article-file-coding-system 'no-conversion) +(defconst gnus-agent-scoreable-headers + (list + "subject" "from" "date" "message-id" + "references" "chars" "lines" "xref") + "Headers that are considered when scoring articles +for download via the Agent.") + ;; Dynamic variables (defvar gnus-headers) (defvar gnus-score) @@ -894,27 +902,63 @@ ;; Parse them and see which articles we want to fetch. (setq gnus-newsgroup-dependencies (make-vector (length articles) 0)) - (setq gnus-newsgroup-headers - (gnus-get-newsgroup-headers-xover articles nil nil group)) + ;; No need to call `gnus-get-newsgroup-headers-xover' with + ;; the entire .overview for group as we still have the just + ;; downloaded headers in `gnus-agent-overview-buffer'. + (let ((nntp-server-buffer gnus-agent-overview-buffer)) + (setq gnus-newsgroup-headers + (gnus-get-newsgroup-headers-xover articles nil nil group))) (setq category (gnus-group-category group)) (setq predicate (gnus-get-predicate (or (gnus-group-get-parameter group 'agent-predicate) (cadr category)))) - (setq score-param - (or (gnus-group-get-parameter group 'agent-score) - (caddr category))) - (when score-param - (gnus-score-headers (list (list score-param)))) - (setq arts nil) - (while (setq gnus-headers (pop gnus-newsgroup-headers)) - (setq gnus-score - (or (cdr (assq (mail-header-number gnus-headers) - gnus-newsgroup-scored)) - gnus-summary-default-score)) - (when (funcall predicate) - (push (mail-header-number gnus-headers) - arts))) + ;; Do we want to download everything, or nothing? + (if (or (eq (caaddr predicate) 'gnus-agent-true) + (eq (caaddr predicate) 'gnus-agent-false)) + ;; Yes. + (setq arts (symbol-value + (cadr (assoc (caaddr predicate) + '((gnus-agent-true articles) + (gnus-agent-false nil)))))) + ;; No, we need to decide what we want. + (setq score-param + (let ((score-method (or + (gnus-group-get-parameter group 'agent-score t) + (caddr category)))) + (when score-method + (require 'gnus-score) + (if (eq score-method 'file) + (let ((entries + (gnus-score-load-files + (gnus-all-score-files group))) + list score-file) + (while (setq list (car entries)) + (push (car list) score-file) + (setq list (cdr list)) + (while list + (when (member (caar list) + gnus-agent-scoreable-headers) + (push (car list) score-file)) + (setq list (cdr list))) + (setq score-param + (append score-param (list (nreverse score-file))) + score-file nil entries (cdr entries))) + (list score-param)) + (if (stringp (car score-method)) + score-method + (list (list score-method))))))) + (when score-param + (gnus-score-headers score-param)) + (setq arts nil) + (while (setq gnus-headers (pop gnus-newsgroup-headers)) + (setq gnus-score + (or (cdr (assq (mail-header-number gnus-headers) + gnus-newsgroup-scored)) + gnus-summary-default-score)) + (when (funcall predicate) + (push (mail-header-number gnus-headers) + arts)))) ;; Fetch the articles. (when arts (gnus-agent-fetch-articles group arts)))