From 35d9881809b4e27d1ae0fe1c7329df8e0968f5f8 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Sat, 7 Nov 2020 09:40:40 -0800 Subject: [PATCH] Various fixes and backward compatibility for gnus-search * lisp/gnus/gnus-group.el (gnus-group-make-search-group, gnus-group-read-ephemeral-search-group): Check for and accept the old nnir-* spec keys. * lisp/gnus/gnus-search.el (shared-initialize): Use generate-new-buffer instead of doing it ourselves. (gnus-search-server-to-engine): Raise an informative error explicitly if we can't find a search engine, rather than letting it fall through to something less helpful. (gnus-search-make-spec): Add `gnus-search--complete-key-data' to `completion-at-point-functions' locally, not globally. --- lisp/gnus/gnus-group.el | 4 ++++ lisp/gnus/gnus-search.el | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index c6f7e1c41ac..9db0e1897a3 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -3186,6 +3186,7 @@ non-nil SPECS arg must be an alist with `search-query-spec' and (let* ((group-spec (or (cdr (assq 'search-group-spec specs)) + (cdr (assq 'nnir-group-spec specs)) (if (gnus-server-server-name) (list (list (gnus-server-server-name))) (seq-group-by @@ -3198,6 +3199,7 @@ non-nil SPECS arg must be an alist with `search-query-spec' and (query-spec (or (cdr (assq 'search-query-spec specs)) + (cdr (assq 'nnir-query-spec specs)) (gnus-search-make-spec no-parse)))) (gnus-group-make-group name @@ -3229,6 +3231,7 @@ non-nil SPECS arg must be an alist with `search-query-spec' and (interactive "P") (let* ((group-spec (or (cdr (assq 'search-group-spec specs)) + (cdr (assq 'nnir-group-spec specs)) (if (gnus-server-server-name) (list (list (gnus-server-server-name))) (seq-group-by @@ -3240,6 +3243,7 @@ non-nil SPECS arg must be an alist with `search-query-spec' and (assoc (gnus-group-topic-name) gnus-topic-alist)))))))) (query-spec (or (cdr (assq 'search-query-spec specs)) + (cdr (assq 'nnir-query-spec specs)) (gnus-search-make-spec no-parse)))) (gnus-group-read-ephemeral-group (concat "nnselect-" (message-unique-id)) diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index 07bd2bca1bb..abee7c47116 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -782,8 +782,7 @@ the files in ARTLIST by that search key.") (cl-defmethod shared-initialize ((engine gnus-search-process) slots) (setq slots (plist-put slots :proc-buffer - (get-buffer-create - (generate-new-buffer-name " *gnus-search-")))) + (generate-new-buffer " *gnus-search-"))) (cl-call-next-method engine slots)) (defclass gnus-search-imap (gnus-search-engine) @@ -1995,7 +1994,7 @@ remaining string, then adds all that to the top-level spec." (nnheader-message 5 "Invalid search engine parameter: (%s %s)" key value))))) - (nnheader-message 5 "No search engine defined for %s" srv)) + (error "No search engine defined for %S" method)) inst)) (declare-function gnus-registry-get-id-key "gnus-registry" (id key)) @@ -2127,7 +2126,8 @@ article came from is also searched." (minibuffer-with-setup-hook (lambda () (add-hook 'completion-at-point-functions - #'gnus-search--complete-key-data)) + #'gnus-search--complete-key-data + nil t)) (read-from-minibuffer "Query: " nil gnus-search-minibuffer-map nil 'gnus-search-history))) -- 2.39.2