From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/71535 Path: news.gmane.org!not-for-mail From: Andrew Cohen Newsgroups: gmane.emacs.gnus.general Subject: Re: nnir and the new nnimap Date: Thu, 23 Sep 2010 08:36:49 -0400 Message-ID: <87aan8ab6m.fsf@andy.bu.edu> References: <1sfwx2nnmu.fsf@voll.uninett.no> <87r5gleh0s.fsf@dod.no> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1285245427 14554 80.91.229.12 (23 Sep 2010 12:37:07 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 23 Sep 2010 12:37:07 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M19908@lists.math.uh.edu Thu Sep 23 14:37:06 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Oyl2u-0005QM-FD for ding-account@gmane.org; Thu, 23 Sep 2010 14:37:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1Oyl2r-0004ML-Tb; Thu, 23 Sep 2010 07:37:02 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1Oyl2q-0004M6-Ao for ding@lists.math.uh.edu; Thu, 23 Sep 2010 07:37:00 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1Oyl2o-00088G-Sb for ding@lists.math.uh.edu; Thu, 23 Sep 2010 07:37:00 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1Oyl2o-00047M-00 for ; Thu, 23 Sep 2010 14:36:58 +0200 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Oyl2o-0005NO-0G for ding@gnus.org; Thu, 23 Sep 2010 14:36:58 +0200 Original-Received: from andy.bu.edu ([128.197.41.152]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Sep 2010 14:36:57 +0200 Original-Received: from cohen by andy.bu.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Sep 2010 14:36:57 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 66 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: andy.bu.edu User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:oqnMBAXYu12V44P5oGyuef3mCu8= X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:71535 Archived-At: --=-=-= Content-Type: text/plain I rely on nnir so I thought I would just try to get it working with minimal rewriting. I haven't tested this much, but it worked on a few simple searches. The main change was to nnir-run-imap, but I also had to make one change to nnimap-retrieve-headers that worries me. Currently this function returns 't, and nnir wants it to return 'headers. I made the change and nothing exploded. Is this OK? Of course all this needs to be rewritten, but in the meantime... --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=nnir.patch Content-Description: nnir.el patch for new imap --- nnir.el 2010-09-22 08:02:59.000000000 -0400 +++ nnir.new.el 2010-09-23 08:35:07.000000000 -0400 @@ -967,23 +967,27 @@ (defs (caddr (gnus-server-to-method srv))) (criteria (or (cdr (assq 'criteria query)) nnir-imap-search-field)) - artlist buf) + (gnus-inhibit-demon t) + artlist) (message "Opening server %s" server) (condition-case () - (when (nnimap-open-server server defs) ;; xxx - (setq buf nnimap-server-buffer) ;; xxx - (message "Searching %s..." group) - (let ((arts 0) - (mbx (gnus-group-real-name group))) - (when (imap-mailbox-select mbx nil buf) - (mapc - (lambda (artnum) - (push (vector group artnum 1) artlist) - (setq arts (1+ arts))) - (imap-search (nnir-imap-make-query criteria qstring) buf)) - (message "Searching %s... %d matches" mbx arts))) - (message "Searching %s...done" group)) - (quit nil)) + (when (nnimap-possibly-change-group (gnus-group-short-name group) server) + (with-current-buffer (nnimap-buffer) + (message "Searching %s..." group) + (let ((arts 0) + (result + (nnimap-command "UID SEARCH %s" + (nnir-imap-make-query criteria qstring)))) + (mapc + (lambda (artnum) + (push (vector group artnum 1) artlist) + (setq arts (1+ arts))) + (and (car result) + (delete 0 (mapcar #'string-to-number + (cdr (assoc "SEARCH" (cdr result))))))) + (message "Searching %s... %d matches" group arts))) + (message "Searching %s...done" group)) + (quit nil)) (reverse artlist)))) (defun nnir-imap-make-query (criteria qstring) --=-=-=--