From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/16331 Path: main.gmane.org!not-for-mail From: Mike McEwan Newsgroups: gmane.emacs.gnus.general Subject: [patch] `gnus-agent-fetch-headers' problems Date: 27 Aug 1998 09:11:58 +0100 Sender: owner-ding@hpc.uh.edu Message-ID: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 (generated by tm-edit 7.108) Content-Type: text/plain; charset=US-ASCII X-Trace: main.gmane.org 1035155215 27047 80.91.224.250 (20 Oct 2002 23:06:55 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 23:06:55 +0000 (UTC) Return-Path: Original-Received: from gwyn.tux.org (gwyn.tux.org [207.96.122.8]) by altair.xemacs.org (8.9.1/8.9.1) with ESMTP id BAA17235 for ; Thu, 27 Aug 1998 01:20:41 -0700 Original-Received: from sina.hpc.uh.edu (Sina.HPC.UH.EDU [129.7.3.5]) by gwyn.tux.org (8.8.8/8.8.8) with ESMTP id EAA06323 for ; Thu, 27 Aug 1998 04:21:54 -0400 Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by sina.hpc.uh.edu (8.7.3/8.7.3) with ESMTP id DAK23572; Thu, 27 Aug 1998 03:21:49 -0500 (CDT) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Thu, 27 Aug 1998 03:18:36 -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 DAA23559 for ; Thu, 27 Aug 1998 03:18:27 -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 SMTP id EAA19836 for ; Thu, 27 Aug 1998 04:18:21 -0400 (EDT) Original-Received: from (lotusland.demon.co.uk) [158.152.62.156] by post.mail.demon.net with smtp (Exim 1.82 #2) id 0zBxG5-0000rg-00; Thu, 27 Aug 1998 08:18:18 +0000 Original-Received: from mike by lotusland.demon.co.uk with local (Exim 2.02 #1) id 0zBxG4-000112-00 for ding@gnus.org; Thu, 27 Aug 1998 09:18:16 +0100 Original-To: ding@gnus.org X-Mailer: Gnus v5.6.39/XEmacs 20.4 - "Emerald" Original-Lines: 121 Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:16331 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:16331 I think I may have finally found out how my `agent' .overview files sometimes have their NOV lines out of sequence :-). The problem is when, in what I may term my `headers only' groups, I mark articles for download via `gnus-downloadable-mark'. The articles are downloaded just fine, but come expiry time, this means that higher numbered headers/articles can be expired *before* these lower numbered articles I've later taken an interest in: Having been more recently downloaded their entries appear later in the history file. The net effect of this is that I end up with gaps in the `gnus-agent-group-alist' for the group concerned. When then calculating what articles to download in `gnus-agent-fetch-headers', the resultant list of articles includes *again* the already expired articles in these `gaps'. This list, with old headers to fetch, is not necessarily a continuous sequence, but `nntp-retrieve-headers-with-xover' thinks that it *is* and fetches the headers via `XOVER first-last' where the gap between articles is less than 5 (default). Headers can then be retrieved that were *not* asked for in the list of headers to fetch. Anyone falling asleep here :-). Continuing... Having retrieved headers into ` *Gnus agent overview*' that are not in the list of articles requested then results in in the test: (if (eq article (read (current-buffer))) in `gnus-agent-copy-nov-line' never being true when we hit one of the nov lines that we didn't ask for. `gnus-agent-braid-nov' continues: (setq articles (cdr articles)) until we hit an article that *should* have its NOV line appended at the end of the buffer. At this point the entire contents of ` *Gnus agent overview*' are whacked on to the end of the .overview file, regardless of the lowly numbered wanted/unwanted articles at the beginning of this buffer. My .overview file is now out of sequence and can have duplicate NOV lines where unwanted articles have been retrieved a second time. Good to get that out of my system, it's been bugging me for months :-). The patch below does it for me (so far). Lars, I don't understand the method that is used in `gnus-agent-fetch-headers' to work out what we want to download. It asks for everything that is unread, but not in `gnus-agent-group-alist'. Surely we're only interested in those headers *after* the last one in this alist? Headers that is, articles are obviously different. -- Mike. (I think the following should apply OK. I've had to do a bit of manual editing to hack out some other stuff I had in here.) (setq articles (cdr articles))--- ChangeLog.orig Wed Aug 26 05:20:31 1998 +++ ChangeLog Thu Aug 27 08:06:35 1998 @@ -1,3 +1,16 @@ +1998-08-27 Mike McEwan + + * gnus-agent.el (gnus-agent-fetch-group-1): Leave the calculation + of `articles' to `gnus-agent-fetch-headers'. + (gnus-agent-fetch-headers): We only want headers that are after + the last entry in `gnus-group-alist'. + Sat Aug 22 10:28:25 1998 Lars Magne Ingebrigtsen * gnus.el: Gnus v5.6.39 is released. --- gnus-agent.el.orig Sun Aug 23 03:21:05 1998 +++ gnus-agent.el Thu Aug 27 08:01:40 1998 @@ -750,18 +750,10 @@ (insert "\n")) (pop gnus-agent-group-alist)))) -(defun gnus-agent-fetch-headers (group articles &optional force) - (gnus-agent-load-alist group) - ;; Find out what headers we need to retrieve. - (when articles - (while (and articles - (assq (car articles) gnus-agent-article-alist)) - (pop articles)) - (let ((arts articles)) - (while (cdr arts) - (if (assq (cadr arts) gnus-agent-article-alist) - (setcdr arts (cddr arts)) - (setq arts (cdr arts))))) +(defun gnus-agent-fetch-headers (group &optional force) + (let ((articles (gnus-uncompress-range + (cons (1+ (caar (last (gnus-agent-load-alist group)))) + (cdr (gnus-active group)))))) ;; Fetch them. (when articles (gnus-message 7 "Fetching headers for %s..." group) @@ -782,7 +774,7 @@ (gnus-agent-enter-history "last-header-fetched-for-session" (list (cons group (nth (- (length articles) 1) articles))) (gnus-time-to-day (current-time))) - t))))) + articles))))) (defsubst gnus-agent-copy-nov-line (article) (let (b e) @@ -842,7 +834,7 @@ (gnus-agent-article-name ".agentview" group))))) (defun gnus-agent-save-alist (group &optional articles state dir) - "Load the article-state alist for GROUP." + "Save the article-state alist for GROUP." (nnheader-temp-write (if dir (concat dir ".agentview") (gnus-agent-article-name ".agentview" group)) @@ -896,8 +888,7 @@ category predicate info marks score-param) ;; Fetch headers. (when (and (or (gnus-active group) (gnus-activate-group group)) - (setq articles (gnus-list-of-unread-articles group)) - (gnus-agent-fetch-headers group articles)) + (setq articles (gnus-agent-fetch-headers group))) ;; Parse them and see which articles we want to fetch. (setq gnus-newsgroup-dependencies (make-vector (length articles) 0))