From 1ec75f95d7d05d529fb1f75abe741ff77de6f16b Mon Sep 17 00:00:00 2001 From: Andrew Cohen Date: Wed, 10 Apr 2013 22:14:14 +0000 Subject: [PATCH] lisp/gnus/nnir.el: Small optimizations. Use 'gnus-group-guess-full-name-from-command-method --- lisp/gnus/ChangeLog | 5 +++++ lisp/gnus/nnir.el | 31 +++++++++++++------------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index b5390fe938f..58de51672e6 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -4,6 +4,11 @@ (nnir-request-set-mark): New function. (nnir-request-update-info): Improve marks updating. (nnir-request-scan): Don't duplicate marks updating. + (gnus-group-make-nnir-group, nnir-run-imap, nnir-request-create-group): + Use 'assq rather than 'assoc. Quote anonymous function. + (nnir-request-group, nnir-close-group, gnus-summary-create-nnir-group): + Use 'gnus-group-prefixed-p. + (gnus-summary-create-nnir-group): Make sure server for method is open. 2013-04-04 Andrew Cohen diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index c6baa301c06..5744b1cd4b0 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -602,7 +602,7 @@ an alist with `nnir-query-spec' and `nnir-group-spec' keys, and skips all prompting." (interactive "P") (let* ((group-spec - (or (cdr (assoc 'nnir-group-spec specs)) + (or (cdr (assq 'nnir-group-spec specs)) (if (gnus-server-server-name) (list (list (gnus-server-server-name))) (nnir-categorize @@ -612,7 +612,7 @@ skips all prompting." (cdr (assoc (gnus-group-topic-name) gnus-topic-alist)))) gnus-group-server)))) (query-spec - (or (cdr (assoc 'nnir-query-spec specs)) + (or (cdr (assq 'nnir-query-spec specs)) (apply 'append (list (cons 'query @@ -659,9 +659,7 @@ skips all prompting." (deffoo nnir-request-group (group &optional server dont-check info) (nnir-possibly-change-group group server) - (let ((pgroup (if (gnus-group-prefixed-p group) - group - (gnus-group-prefixed-name group '(nnir "nnir")))) + (let ((pgroup (gnus-group-guess-full-name-from-command-method group)) length) ;; Check for cached search result or run the query and cache the ;; result. @@ -893,9 +891,7 @@ skips all prompting." (deffoo nnir-close-group (group &optional server) - (let ((pgroup (if (gnus-group-prefixed-p group) - group - (gnus-group-prefixed-name group '(nnir "nnir"))))) + (let ((pgroup (gnus-group-guess-full-name-from-command-method group))) (when (and nnir-artlist (not (gnus-ephemeral-group-p pgroup))) (gnus-group-set-parameter pgroup 'nnir-artlist nnir-artlist)) (setq nnir-artlist nil) @@ -972,7 +968,7 @@ details on the language and supported extensions." 'vconcat (catch 'found (mapcar - (lambda (group) + #'(lambda (group) (let (artlist) (condition-case () (when (nnimap-possibly-change-group @@ -1870,12 +1866,11 @@ article came from is also searched." (defun gnus-summary-create-nnir-group () (interactive) + (or (nnir-server-opened "") (nnir-open-server "nnir")) (let ((name (gnus-read-group "Group name: ")) - (method "nnir") - (pgroup (if (gnus-group-prefixed-p gnus-newsgroup-name) - gnus-newsgroup-name - (gnus-group-prefixed-name - gnus-newsgroup-name '(nnir "nnir"))))) + (method '(nnir "")) + (pgroup + (gnus-group-guess-full-name-from-command-method gnus-newsgroup-name))) (with-current-buffer gnus-group-buffer (gnus-group-make-group name method nil @@ -1885,20 +1880,20 @@ article came from is also searched." (deffoo nnir-request-create-group (group &optional server args) (message "Creating nnir group %s" group) (let* ((group (gnus-group-prefixed-name group '(nnir "nnir"))) - (specs (assoc 'nnir-specs args)) + (specs (assq 'nnir-specs args)) (query-spec - (or (cdr (assoc 'nnir-query-spec specs)) + (or (cdr (assq 'nnir-query-spec specs)) (list (cons 'query (read-string "Query: " nil 'nnir-search-history))))) (group-spec - (or (cdr (assoc 'nnir-group-spec specs)) + (or (cdr (assq 'nnir-group-spec specs)) (list (list (read-string "Server: " nil nil))))) (nnir-specs (list (cons 'nnir-query-spec query-spec) (cons 'nnir-group-spec group-spec)))) (gnus-group-set-parameter group 'nnir-specs nnir-specs) (gnus-group-set-parameter group 'nnir-artlist - (or (cdr (assoc 'nnir-artlist args)) + (or (cdr (assq 'nnir-artlist args)) (nnir-run-query nnir-specs))) (nnir-request-update-info group (gnus-get-info group))) t) -- 2.39.2