Gnus development mailing list
 help / color / mirror / Atom feed
From: Julien Danjou <julien@danjou.info>
To: Michael Welsh Duggan <md5i@md5i.com>
Cc: ding@gnus.org
Subject: Re: searching by Message-ID after copy/move; speeding things up
Date: Thu, 14 Jun 2012 10:10:12 +0200	[thread overview]
Message-ID: <877gvamhzv.fsf@zelenka.enovance.com> (raw)
In-Reply-To: <87395ypkri.fsf@maru.md5i.com> (Michael Welsh Duggan's message of "Thu, 14 Jun 2012 00:42:09 -0400")


[-- Attachment #1.1: Type: text/plain, Size: 336 bytes --]

On Thu, Jun 14 2012, Michael Welsh Duggan wrote:

> The change was quite simple, and most of my time was spent re-learning
> how the nnimap library does things in general.  I hope that something
> like this can make it into mainline Gnus.

Attached is an experimental patch. Could you test it and tell me if this
resolve your problem?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Add-recent-argument-to-nnimap-find-article-by-messag.patch --]
[-- Type: text/x-diff, Size: 2472 bytes --]

From 743f0f50fcfb2779f1ba16382cc0fca9b1364585 Mon Sep 17 00:00:00 2001
From: Julien Danjou <julien@danjou.info>
Date: Thu, 14 Jun 2012 10:09:04 +0200
Subject: [PATCH] Add recent argument to nnimap-find-article-by-message-id

Signed-off-by: Julien Danjou <julien@danjou.info>
---
 lisp/ChangeLog |    7 +++++++
 lisp/nnimap.el |   11 ++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 20a586e..9d0f184 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2012-06-14  Julien Danjou  <julien@danjou.info>
+
+	* nnimap.el (nnimap-find-article-by-message-id): Add docstring and
+	recent argument.
+	(nnimap-request-move-article): Use the recent option of
+	`nnimap-find-article-by-message-id'.
+
 2012-06-11  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 	* gnus-art.el (gnus-article-read-summary-keys): Protect against the key
diff --git a/lisp/nnimap.el b/lisp/nnimap.el
index 5bdf226..0bd45de 100644
--- a/lisp/nnimap.el
+++ b/lisp/nnimap.el
@@ -867,7 +867,7 @@ textual parts.")
 		(cons internal-move-group
 		      (or (nnimap-find-uid-response "COPYUID" (cadr result))
 			  (nnimap-find-article-by-message-id
-			   internal-move-group message-id)))))
+			   internal-move-group message-id t)))))
 	  ;; Move the article to a different method.
 	  (let ((result (eval accept-form)))
 	    (when result
@@ -969,7 +969,10 @@ textual parts.")
 			       (cdr (assoc "SEARCH" (cdr result))))))))))
 
 
-(defun nnimap-find-article-by-message-id (group message-id)
+(defun nnimap-find-article-by-message-id (group message-id &optional recent)
+  "Search for message with MESSAGE-ID in GROUP.
+RECENT can be used to look only in message having the \Resent
+flag set, fastening the search.."
   (with-current-buffer (nnimap-buffer)
     (erase-buffer)
     (unless (equal group (nnimap-group nnimap-object))
@@ -977,7 +980,9 @@ textual parts.")
       (setf (nnimap-examined nnimap-object) group)
       (nnimap-send-command "EXAMINE %S" (utf7-encode group t)))
     (let ((sequence
-	   (nnimap-send-command "UID SEARCH HEADER Message-Id %S" message-id))
+	   (nnimap-send-command "UID SEARCH HEADER Message-Id %S%s"
+                                message-id
+                                (if recent " RECENT" "")))
 	  article result)
       (setq result (nnimap-wait-for-response sequence))
       (when (and result
-- 
1.7.10


[-- Attachment #1.3: Type: text/plain, Size: 26 bytes --]


-- 
           Julien

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

  reply	other threads:[~2012-06-14  8:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14  4:42 Michael Welsh Duggan
2012-06-14  8:10 ` Julien Danjou [this message]
2012-06-14 19:51   ` Michael Welsh Duggan
2012-06-14 19:59     ` Julien Danjou
2012-06-14 20:11       ` Michael Welsh Duggan
2012-06-15 14:17         ` Julien Danjou
2012-06-15 15:11           ` Michael Welsh Duggan
2012-06-19  8:53             ` Julien Danjou
2012-06-19 15:33               ` Michael Welsh Duggan
2012-06-25 11:23                 ` Julien Danjou
2012-06-25 14:00                   ` Michael Welsh Duggan

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=877gvamhzv.fsf@zelenka.enovance.com \
    --to=julien@danjou.info \
    --cc=ding@gnus.org \
    --cc=md5i@md5i.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).