Gnus development mailing list
 help / color / mirror / Atom feed
From: Kevin Greiner <kgreiner@xpediantsolutions.com>
Subject: Re: gnus-agent showing wrong data: some investigations
Date: Sat, 22 Feb 2003 11:54:39 -0600	[thread overview]
Message-ID: <u65rcxktc.fsf@xpediantsolutions.com> (raw)
In-Reply-To: <84y948mi7f.fsf@lucy.is.informatik.uni-duisburg.de>

kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:

> Kevin Greiner <kgreiner@xpediantsolutions.com> writes:
>
>> I've added a sort to my copy.  I should have it checked-in this
>> weekend unless you beat me to it.
>
> I didn't commit it because I think it isn't right.  It would be
> doctoring the symptoms instead of curing the disease.  At least
> that's the way I understand it.

The problem is that gnus-newsgroup-headers IS SORTED, just not in
ascending order.  If I remember right, it matches the order of the
articles in the summary buffer.

> OTOH, I've been looking at where gnus-newsgroup-headers comes from,
> and it could indeed come from a non-sorted input.  Hm.  (For example,
> if gnus-select-newsgroup is called with some articles to select, then
> that list of articles could be non-sorted.)  Hmmm...  An uneasy
> feeling remains.  I'm not sure what to do, or what to think.
>

Here's what I'm currently trying.

(defun gnus-agent-get-undownloaded-list ()
  "Construct list of articles that have not been downloaded."
  (let ((gnus-command-method (gnus-find-method-for-group gnus-newsgroup-name)))
    (when (set (make-local-variable 'gnus-newsgroup-agentized) (gnus-agent-method-p gnus-command-method))
      (let* ((alist (gnus-agent-load-alist gnus-newsgroup-name))
             (headers (sort (mapcar (lambda (h) (mail-header-number h)) gnus-newsgroup-headers) '<))
             (undownloaded (list nil))
             (tail-undownloaded undownloaded)
             (unfetched (list nil))
             (tail-unfetched unfetched))
        (while (and alist headers)
          (let ((a (caar alist))
                (h (car headers)))
            (cond ((< a h)
                   ;; Ignore IDs in the alist that are not being
                   ;; displayed in the summary.
                   (pop alist))
                  ((> a h)
                   ;; Headers that are not in the alist should be
                   ;; fictious (see nnagent-retrieve-headers); they
                   ;; imply that this article isn't in the agent.
                   (gnus-agent-append-to-list tail-undownloaded h)
                   (gnus-agent-append-to-list tail-unfetched    h)
                   (pop headers)) 
                  ((cdar alist)
                   (pop alist)
                   (pop headers)
                   nil                  ; ignore already downloaded
                   )
                  (t
                   (pop alist)
                   (pop headers)
                   (gnus-agent-append-to-list tail-undownloaded a)))))

        (while headers
          (let ((num (pop headers)))
            (gnus-agent-append-to-list tail-undownloaded num)
            (gnus-agent-append-to-list tail-unfetched    num)))

        (setq gnus-newsgroup-undownloaded (cdr undownloaded)
              gnus-newsgroup-unfetched    (cdr unfetched))))))

Kevin



  reply	other threads:[~2003-02-22 17:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-22 12:49 Kai Großjohann
2003-02-22 12:55 ` Kai Großjohann
2003-02-22 13:21 ` Kai Großjohann
2003-02-22 13:23   ` Kai Großjohann
2003-02-22 15:02     ` Kevin Greiner
2003-02-22 15:46       ` Kai Großjohann
2003-02-22 17:54         ` Kevin Greiner [this message]
2003-02-22 20:42           ` Kai Großjohann
2003-02-23 21:26             ` Kevin Greiner
2003-02-24 12:11               ` Kai Großjohann

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=u65rcxktc.fsf@xpediantsolutions.com \
    --to=kgreiner@xpediantsolutions.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).