From: Andrew Cohen Date: Wed, 20 Jul 2011 15:24:16 +0000 (+0000) Subject: nnir.el (gnus-group-make-nnir-group): Allow optional search query argument. X-Git-Tag: emacs-pretest-24.0.90~104^2~187 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=59f1b8949499f35fbdf3761acc8dd651fa69d335;p=emacs.git nnir.el (gnus-group-make-nnir-group): Allow optional search query argument. (gnus-group-make-nnir-group, nnir-request-group, nnir-run-query): Use `nnir-address' to handle server info rather than passing an arg. --- diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 3dc1fe142bf..a1cb003a8ff 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,5 +1,10 @@ 2011-07-20 Andrew Cohen + * nnir.el (gnus-group-make-nnir-group): Allow optional search query + argument. + (gnus-group-make-nnir-group, nnir-request-group, nnir-run-query): Use + `nnir-address' to handle server info rather than passing an arg. + * nnimap.el (nnimap-make-thread-query): New utility function to format an imap thread search query. (nnimap-request-thread): Use it. diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 3f140ef59d9..9840dddcb66 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -296,6 +296,9 @@ is `(valuefunc member)'." (nnoo-declare nnir) (nnoo-define-basics nnir) +(defvoo nnir-address nil + "The address of the nnir server.") + (gnus-declare-backend "nnir" 'mail) @@ -582,18 +585,17 @@ Add an entry here when adding a new search engine.") ;; Gnus glue. -(defun gnus-group-make-nnir-group (nnir-extra-parms) +(defun gnus-group-make-nnir-group (nnir-extra-parms &optional parms) "Create an nnir group. Asks for query." (interactive "P") (setq nnir-current-query nil nnir-current-server nil nnir-current-group-marked nil nnir-artlist nil) - (let* ((query (read-string "Query: " nil 'nnir-search-history)) - (parms (list (cons 'query query))) - (srv (if (gnus-server-server-name) - "all" ""))) - (add-to-list 'parms (cons 'unique-id (message-unique-id)) t) + (let* ((query (unless parms (read-string "Query: " nil 'nnir-search-history))) + (parms (or parms (list (cons 'query query)))) + (srv (or (cdr (assq 'server parms)) (gnus-server-server-name) "nnir"))) + (add-to-list 'parms (cons 'unique-id (message-unique-id)) t) (gnus-group-read-ephemeral-group (concat "nnir:" (prin1-to-string parms)) (list 'nnir srv) t (cons (current-buffer) gnus-current-window-configuration) @@ -617,7 +619,7 @@ Add an entry here when adding a new search engine.") (equal server nnir-current-server))) nnir-artlist ;; Cache miss. - (setq nnir-artlist (nnir-run-query group server))) + (setq nnir-artlist (nnir-run-query group))) (with-current-buffer nntp-server-buffer (setq nnir-current-query group) (when server (setq nnir-current-server server)) @@ -1594,14 +1596,13 @@ actually)." (autoload 'gnus-group-topic-name "gnus-topic") -(defun nnir-run-query (query nserver) +(defun nnir-run-query (query) "Invoke appropriate search engine function (see `nnir-engines'). If some groups were process-marked, run the query for each of the groups and concat the results." (let ((q (car (read-from-string query))) - (groups (if (string= "all-ephemeral" nserver) - (with-current-buffer gnus-server-buffer - (list (list (gnus-server-server-name)))) + (groups (if (not (string= "nnir" nnir-address)) + (list (list nnir-address)) (nnir-categorize (or gnus-group-marked (if (gnus-group-group-name)