Gnus development mailing list
 help / color / mirror / Atom feed
From: Andrew Cohen <cohen@andy.bu.edu>
To: ding@gnus.org
Subject: Re: nnir and the new nnimap
Date: Thu, 23 Sep 2010 08:36:49 -0400	[thread overview]
Message-ID: <87aan8ab6m.fsf@andy.bu.edu> (raw)
In-Reply-To: <m3ocbp8nbj.fsf@quimbies.gnus.org>

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]

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...



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnir.el patch for new imap --]
[-- Type: text/x-diff, Size: 1728 bytes --]

--- 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)

  reply	other threads:[~2010-09-23 12:36 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-21 18:58 Knut Anders Hatlen
2010-09-21 21:37 ` Lars Magne Ingebrigtsen
2010-09-22  9:17   ` Vegard Vesterheim
2010-09-22 16:38     ` Lars Magne Ingebrigtsen
2010-09-22 19:04       ` Steinar Bang
2010-09-22 19:50         ` Lars Magne Ingebrigtsen
2010-09-22 20:27           ` Lars Magne Ingebrigtsen
2010-09-22 21:25             ` Knut Anders Hatlen
2010-09-22 21:31               ` Lars Magne Ingebrigtsen
2010-09-22 21:42                 ` Knut Anders Hatlen
2010-09-22 21:45                   ` Lars Magne Ingebrigtsen
2010-09-23 12:36                     ` Andrew Cohen [this message]
2010-09-23 17:33                       ` Lars Magne Ingebrigtsen
2010-09-23 21:11                         ` Andrew Cohen
2010-09-23 21:17                           ` Lars Magne Ingebrigtsen
2010-09-22 10:11   ` Steinar Bang
2010-09-22 16:39     ` Lars Magne Ingebrigtsen
2010-09-22 19:03       ` Steinar Bang
2010-09-24  7:36       ` Vegard Vesterheim
2010-09-24  8:10         ` Steinar Bang
2010-09-24 16:14         ` Lars Magne Ingebrigtsen
2010-09-25 12:02           ` Andrew Cohen
2010-09-25 14:19             ` Lars Magne Ingebrigtsen

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=87aan8ab6m.fsf@andy.bu.edu \
    --to=cohen@andy.bu.edu \
    --cc=ding@gnus.org \
    /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).