From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/4434 Path: main.gmane.org!not-for-mail From: visigoth@olivier.pc.cs.cmu.edu (John McClary Prevost) Newsgroups: gmane.emacs.gnus.general Subject: Questions about backend interface and ranges Date: 14 Dec 1995 22:38:57 -0500 Organization: Dementia Linux Cabal Message-ID: NNTP-Posting-Host: coloc-standby.netfonds.no X-Trace: main.gmane.org 1035145179 29553 80.91.224.250 (20 Oct 2002 20:19:39 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 20:19:39 +0000 (UTC) Return-Path: ding-request@ifi.uio.no Original-Received: from ifi.uio.no (ifi.uio.no [129.240.64.2]) by miranova.com (8.6.11/8.6.9) with ESMTP id UAA31179 for ; Thu, 14 Dec 1995 20:04:00 -0800 Original-Received: from olivier.dementia.org (visigoth@OLIVIER.PC.CS.CMU.EDU [128.2.250.73]) by ifi.uio.no with ESMTP (8.6.11/ifi2.4) id for ; Fri, 15 Dec 1995 04:39:56 +0100 Original-Received: (from visigoth@localhost) by olivier.dementia.org (8.6.11/8.6.9) id WAA03349; Thu, 14 Dec 1995 22:39:00 -0500 Original-To: ding@ifi.uio.no Original-Lines: 52 Xref: main.gmane.org gmane.emacs.gnus.general:4434 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:4434 I have a couple of questions about ranges and about the interface of nn*-retrieve-headers. The ARTICLES argument of retrieve-headers is said to take "either a range of article numbers or a list of Message-IDs." I take that to mean that it can contain Message-IDs, or a range, but not both? Second, I'm about to implement a set of "useful range operations" in order to get the nnimap stuff working better. Here's what I plan to implement: (nnimap-range-split RANGE &optional COUNT) This function takes a RANGE and returns a cons cell of a range containing the first numerical member of the range and the range without that first member. I.e.: (nnimap-range-split ((1 . 5) 7)) => ( (1) . ((2 . 5) 7) ) If the optional COUNT is given, COUNT items are returned as a second range. Like so: (nnimap-range-split '((1 . 20) (30 . 500)) 400) => ( ((1 . 20) (30 . 410)) . (411 . 500) ) [ The function might better be split into two: *-range-head and *-range-tail ] This operation is fairly simple, and it is useful for two reasons. First, a backend can use it to chop off a single item from a range at a time, in order to do retrieve operations via methods that can only deal with getting one article at a time. Second, a protocol like IMAP which can request multiple messages at a time (basically, you can get a single article or an unbroken range of articles but not combinations of the two) can use it to break a range down into bite-sized chunks--this is good, because doing an (nnimap-retrieve-headers '((1 . 1000))) right now doesn't give much feedback until the operation is complete--it's too busy reading things in. This could result in deadlock, I assume, since nntp.el is worried about reading things in every so often. That function would be extremely useful, as would two others: (*-range-length RANGE) : returns the number of individual articles in a range. (*-range-eq RANGE1 RANGE2) : returns t if they're equivalent, nil if not. This is a fairly easy operation, and has O(n+m) where n is the number of discrete elements in RANGE1 and m is the number in RANGE2. I'll code these into my nnimap.el for the time-being, but they'd probably be better off in some other piece of code.