aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Abrahamsen2020-11-07 09:40:40 -0800
committerEric Abrahamsen2020-11-07 09:44:10 -0800
commit35d9881809b4e27d1ae0fe1c7329df8e0968f5f8 (patch)
tree02acbf393f50b7d8582342a44e2c719d15952b02
parente8f5657bc7f6e0e45f70e4849736c6e87d44a1ac (diff)
downloademacs-35d9881809b4e27d1ae0fe1c7329df8e0968f5f8.tar.gz
emacs-35d9881809b4e27d1ae0fe1c7329df8e0968f5f8.zip
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.
-rw-r--r--lisp/gnus/gnus-group.el4
-rw-r--r--lisp/gnus/gnus-search.el8
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
3186 (let* ((group-spec 3186 (let* ((group-spec
3187 (or 3187 (or
3188 (cdr (assq 'search-group-spec specs)) 3188 (cdr (assq 'search-group-spec specs))
3189 (cdr (assq 'nnir-group-spec specs))
3189 (if (gnus-server-server-name) 3190 (if (gnus-server-server-name)
3190 (list (list (gnus-server-server-name))) 3191 (list (list (gnus-server-server-name)))
3191 (seq-group-by 3192 (seq-group-by
@@ -3198,6 +3199,7 @@ non-nil SPECS arg must be an alist with `search-query-spec' and
3198 (query-spec 3199 (query-spec
3199 (or 3200 (or
3200 (cdr (assq 'search-query-spec specs)) 3201 (cdr (assq 'search-query-spec specs))
3202 (cdr (assq 'nnir-query-spec specs))
3201 (gnus-search-make-spec no-parse)))) 3203 (gnus-search-make-spec no-parse))))
3202 (gnus-group-make-group 3204 (gnus-group-make-group
3203 name 3205 name
@@ -3229,6 +3231,7 @@ non-nil SPECS arg must be an alist with `search-query-spec' and
3229 (interactive "P") 3231 (interactive "P")
3230 (let* ((group-spec 3232 (let* ((group-spec
3231 (or (cdr (assq 'search-group-spec specs)) 3233 (or (cdr (assq 'search-group-spec specs))
3234 (cdr (assq 'nnir-group-spec specs))
3232 (if (gnus-server-server-name) 3235 (if (gnus-server-server-name)
3233 (list (list (gnus-server-server-name))) 3236 (list (list (gnus-server-server-name)))
3234 (seq-group-by 3237 (seq-group-by
@@ -3240,6 +3243,7 @@ non-nil SPECS arg must be an alist with `search-query-spec' and
3240 (assoc (gnus-group-topic-name) gnus-topic-alist)))))))) 3243 (assoc (gnus-group-topic-name) gnus-topic-alist))))))))
3241 (query-spec 3244 (query-spec
3242 (or (cdr (assq 'search-query-spec specs)) 3245 (or (cdr (assq 'search-query-spec specs))
3246 (cdr (assq 'nnir-query-spec specs))
3243 (gnus-search-make-spec no-parse)))) 3247 (gnus-search-make-spec no-parse))))
3244 (gnus-group-read-ephemeral-group 3248 (gnus-group-read-ephemeral-group
3245 (concat "nnselect-" (message-unique-id)) 3249 (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.")
782(cl-defmethod shared-initialize ((engine gnus-search-process) 782(cl-defmethod shared-initialize ((engine gnus-search-process)
783 slots) 783 slots)
784 (setq slots (plist-put slots :proc-buffer 784 (setq slots (plist-put slots :proc-buffer
785 (get-buffer-create 785 (generate-new-buffer " *gnus-search-")))
786 (generate-new-buffer-name " *gnus-search-"))))
787 (cl-call-next-method engine slots)) 786 (cl-call-next-method engine slots))
788 787
789(defclass gnus-search-imap (gnus-search-engine) 788(defclass gnus-search-imap (gnus-search-engine)
@@ -1995,7 +1994,7 @@ remaining string, then adds all that to the top-level spec."
1995 (nnheader-message 1994 (nnheader-message
1996 5 "Invalid search engine parameter: (%s %s)" 1995 5 "Invalid search engine parameter: (%s %s)"
1997 key value))))) 1996 key value)))))
1998 (nnheader-message 5 "No search engine defined for %s" srv)) 1997 (error "No search engine defined for %S" method))
1999 inst)) 1998 inst))
2000 1999
2001(declare-function gnus-registry-get-id-key "gnus-registry" (id key)) 2000(declare-function gnus-registry-get-id-key "gnus-registry" (id key))
@@ -2127,7 +2126,8 @@ article came from is also searched."
2127 (minibuffer-with-setup-hook 2126 (minibuffer-with-setup-hook
2128 (lambda () 2127 (lambda ()
2129 (add-hook 'completion-at-point-functions 2128 (add-hook 'completion-at-point-functions
2130 #'gnus-search--complete-key-data)) 2129 #'gnus-search--complete-key-data
2130 nil t))
2131 (read-from-minibuffer 2131 (read-from-minibuffer
2132 "Query: " nil gnus-search-minibuffer-map 2132 "Query: " nil gnus-search-minibuffer-map
2133 nil 'gnus-search-history))) 2133 nil 'gnus-search-history)))