From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/44494 Path: main.gmane.org!not-for-mail From: Simon Josefsson Newsgroups: gmane.emacs.gnus.general Subject: Re: Faster nnimap: nnimap-retrieve-groups-asynchronous Date: Tue, 30 Apr 2002 09:59:57 +0200 (CEST) Sender: owner-ding@hpc.uh.edu Message-ID: References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT X-Trace: main.gmane.org 1020153718 14384 127.0.0.1 (30 Apr 2002 08:01:58 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 30 Apr 2002 08:01:58 +0000 (UTC) Cc: ding@gnus.org Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 172SaE-0003jt-00 for ; Tue, 30 Apr 2002 10:01:58 +0200 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 172SYh-0004ko-00; Tue, 30 Apr 2002 03:00:23 -0500 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Tue, 30 Apr 2002 03:00:34 -0500 (CDT) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id DAA00158 for ; Tue, 30 Apr 2002 03:00:20 -0500 (CDT) Original-Received: (qmail 21683 invoked by alias); 30 Apr 2002 08:00:01 -0000 Original-Received: (qmail 21660 invoked from network); 30 Apr 2002 08:00:00 -0000 Original-Received: from 178.230.13.217.in-addr.dgcsystems.net (HELO yxa.extundo.com) (217.13.230.178) by gnus.org with SMTP; 30 Apr 2002 08:00:00 -0000 Original-Received: from yxa.extundo.com (localhost.localdomain [127.0.0.1]) by yxa.extundo.com (8.12.2/8.12.2) with ESMTP id g3U7xwKg029314; Tue, 30 Apr 2002 09:59:58 +0200 Original-Received: from localhost (jas@localhost) by yxa.extundo.com (8.12.2/8.12.1/Submit) with ESMTP id g3U7xw9F029311; Tue, 30 Apr 2002 09:59:58 +0200 X-Authentication-Warning: yxa.extundo.com: jas owned process doing -bs Original-To: Ilpo =?iso-8859-1?q?Nyyss=F6nen?= In-Reply-To: Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:44494 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:44494 On Tue, 30 Apr 2002, Ilpo Nyyssönen wrote: > Fresh Oort Gnus from CVS gives me this with my Courier IMAP: > > Signaling: (wrong-type-argument number-char-or-marker-p nil) > nnimap-retrieve-groups(("inbox.Trash" "inbox.news" "inbox.sent" "inbox") "ypy") Try evaluating (load "nnimap.el") to get a better backtrace. Anyway, it seems as if Courier has some problems, probably caused by them using too large UIDNEXT values (larger than emacs lisp integer limit). Please try patch below. Does anyone know if Elisp already has a string<-numerical? My implementation is probably not the fastest. Index: imap.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/imap.el,v retrieving revision 6.37 diff -u -p -r6.37 imap.el --- imap.el 2002/04/29 16:42:29 6.37 +++ imap.el 2002/04/29 20:03:42 @@ -2128,8 +2128,8 @@ Return nil if no complete line has arriv (imap-forward) (cond ((search-forward "PERMANENTFLAGS " nil t) (imap-mailbox-put 'permanentflags (imap-parse-flag-list))) - ((search-forward "UIDNEXT " nil t) - (imap-mailbox-put 'uidnext (read (current-buffer)))) + ((search-forward "UIDNEXT \\([0-9]+\\)" nil t) + (imap-mailbox-put 'uidnext (match-string 1))) ((search-forward "UNSEEN " nil t) (imap-mailbox-put 'unseen (read (current-buffer)))) ((looking-at "UIDVALIDITY \\([0-9]+\\)") @@ -2302,7 +2302,9 @@ Return nil if no complete line has arriv ((eq token 'RECENT) (imap-mailbox-put 'recent (read (current-buffer)) mailbox)) ((eq token 'UIDNEXT) - (imap-mailbox-put 'uidnext (read (current-buffer)) mailbox)) + (and (looking-at " \\([0-9]+\\)") + (imap-mailbox-put 'uidnext (match-string 1) mailbox) + (goto-char (match-end 1)))) ((eq token 'UIDVALIDITY) (and (looking-at " \\([0-9]+\\)") (imap-mailbox-put 'uidvalidity (match-string 1) mailbox) Index: nnimap.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/nnimap.el,v retrieving revision 6.30 diff -u -p -r6.30 nnimap.el --- nnimap.el 2002/04/29 19:28:02 6.30 +++ nnimap.el 2002/04/29 20:03:42 @@ -938,6 +938,23 @@ function is generally only called when G ;; Optional backend functions +(defun nnimap-string-lessp-numerical (s1 s2) + "Return t if first arg string is less than second in numerical order." + (cond ((string= s1 s2) + nil) + ((> (length s1) (length s2)) + nil) + ((< (length s1) (length s2)) + t) + ((< (string-to-number (substring s1 0 1)) + (string-to-number (substring s2 0 1))) + t) + ((> (string-to-number (substring s1 0 1)) + (string-to-number (substring s2 0 1))) + nil) + (t + (nnimap-string-lessp-numerical (substring s1 1) (substring s2 1))))) + (deffoo nnimap-retrieve-groups (groups &optional server) (when (nnimap-possibly-change-server server) (gnus-message 5 "nnimap: Checking mailboxes...") @@ -959,8 +976,9 @@ function is generally only called when G (tag (nth 1 asyncgroup)) new old) (when (imap-ok-p (imap-wait-for-tag tag nnimap-server-buffer)) - (if (< (car (gnus-gethash group nnimap-mailbox-info)) - (imap-mailbox-get 'uidnext group nnimap-server-buffer)) + (if (nnimap-string-lessp-numerical + (car (gnus-gethash group nnimap-mailbox-info)) + (imap-mailbox-get 'uidnext group nnimap-server-buffer)) (push (list group) slowgroups) (insert (cdr (gnus-gethash group nnimap-mailbox-info)))))))) (dolist (group slowgroups)