[gnus git] branch master updated: n0-17-137-g870108f =1= (nnir-run-imap): Allow halting search once article found. Use in nnir-request-article by Message-ID.
Andrew Cohen <[email protected]>
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via 870108f91183e319ab2a92d2e6f7a32ac95d5126 (commit)
from 96abea840b45eec3c3bfb249e5da77227b76fcc5 (commit)
- Log -----------------------------------------------------------------
commit 870108f91183e319ab2a92d2e6f7a32ac95d5126
Author: Andrew Cohen <[email protected]>
Date: Sat Jul 2 07:51:45 2011 -0400
(nnir-run-imap): Allow halting search once article found.
Use in nnir-request-article by Message-ID.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0f97039..3bd9ce3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2011-07-02 Andrew Cohen <[email protected]>
+
+ * nnir.el (nnir-run-imap): Allow halting a search when an article is
+ found by setting `shortcut' in 'query.
+ (nnir-request-article): Use `shortcut' setting when requesting article
+ by Message-ID.
+
2011-07-02 Teodor Zlatanov <[email protected]>
* gnus-msg.el (gnus-bug): Give the Version and Package headers to
diff --git a/lisp/nnir.el b/lisp/nnir.el
index 732316a..71b8518 100644
--- a/lisp/nnir.el
+++ b/lisp/nnir.el
@@ -672,7 +672,8 @@ Add an entry here when adding a new search engine.")
(list
(cons 'query (format "HEADER Message-ID %s" article))
(cons 'unique-id article)
- (cons 'criteria "")))
+ (cons 'criteria "")
+ (cons 'shortcut t)))
(unless (and (equal query nnir-current-query)
(equal server nnir-current-server))
(setq nnir-artlist (nnir-run-imap query server))
@@ -791,7 +792,7 @@ ready to be added to the list of search results."
(defun nnir-run-imap (query srv &optional groups)
"Run a search against an IMAP back-end server.
This uses a custom query language parser; see `nnir-imap-make-query' for
-details on the language and supported extensions"
+details on the language and supported extensions."
(save-excursion
(let ((qstring (cdr (assq 'query query)))
(server (cadr (gnus-server-to-method srv)))
@@ -804,6 +805,7 @@ details on the language and supported extensions"
(message "Opening server %s" server)
(apply
'vconcat
+ (catch 'found
(mapcar
(lambda (group)
(let (artlist)
@@ -824,13 +826,15 @@ details on the language and supported extensions"
(when (> artn 0)
(push (vector group artn 100)
artlist)
+ (when (assq 'shortcut query)
+ (throw 'found (list artlist)))
(setq arts (1+ arts)))))
(and (car result) (cdr (assoc "SEARCH" (cdr result)))))
(message "Searching %s... %d matches" group arts)))
(message "Searching %s...done" group))
(quit nil))
(nreverse artlist)))
- groups)))))
+ groups))))))
(defun nnir-imap-make-query (criteria qstring)
"Parse the query string and criteria into an appropriate IMAP search
-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.
Summary of changes:
lisp/ChangeLog | 7 ++++++
lisp/nnir.el | 62 +++++++++++++++++++++++++++++--------------------------
2 files changed, 40 insertions(+), 29 deletions(-)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".
The branch, master has been updated
hooks/post-receive
--
Gnus Project