diff options
author | Gnus developers <ding@gnus.org> | 2011-07-02 13:26:49 +0000 |
---|---|---|
committer | Katsumi Yamaoka <yamaoka@jpl.org> | 2011-07-02 13:26:49 +0000 |
commit | 67aa99ff0699ce18b97c4a72cdb000c030dbbebe (patch) | |
tree | 07e65ea1a1c93cbd28a74c1100b336791c3066a8 /lisp/gnus/nnir.el | |
parent | 6e560c713408d95269e14c879ad3b0b59b536df9 (diff) | |
download | emacs-67aa99ff0699ce18b97c4a72cdb000c030dbbebe.tar.gz emacs-67aa99ff0699ce18b97c4a72cdb000c030dbbebe.tar.bz2 emacs-67aa99ff0699ce18b97c4a72cdb000c030dbbebe.zip |
Merge changes made in Gnus trunk.
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.
gnus-msg.el (gnus-bug): Give the Version and Package headers to debbugs with the X-Debbugs-Package and X-Debbugs-Version headers. Bring the pseudo-headers back too.
Diffstat (limited to 'lisp/gnus/nnir.el')
-rw-r--r-- | lisp/gnus/nnir.el | 62 |
1 files changed, 33 insertions, 29 deletions
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 732316a71f4..71b85183e0f 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/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,33 +805,36 @@ details on the language and supported extensions" (message "Opening server %s" server) (apply 'vconcat - (mapcar - (lambda (group) - (let (artlist) - (condition-case () - (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" - (if (string= criteria "") - qstring - (nnir-imap-make-query - criteria qstring))))) - (mapc - (lambda (artnum) - (let ((artn (string-to-number artnum))) - (when (> artn 0) - (push (vector group artn 100) - 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))))) + (catch 'found + (mapcar + (lambda (group) + (let (artlist) + (condition-case () + (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" + (if (string= criteria "") + qstring + (nnir-imap-make-query + criteria qstring))))) + (mapc + (lambda (artnum) + (let ((artn (string-to-number artnum))) + (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)))))) (defun nnir-imap-make-query (criteria qstring) "Parse the query string and criteria into an appropriate IMAP search |