branch: externals/gnorb
commit 40fe377c3b64a3ada84b0188324785de9b91cbeb
Author: Eric Abrahamsen <[email protected]>
Commit: Stefan Monnier <[email protected]>
Gnorb: Try harder to find the nngnorb server
* packages/gnorb/gnorb-gnus.el (gnorb-gnus-search-messages): Check
gnus-secondary-select-methods, gnus-server-alist, and
gnus-server-method-cache.
---
gnorb-gnus.el | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/gnorb-gnus.el b/gnorb-gnus.el
index 0750261..dfef37a 100644
--- a/gnorb-gnus.el
+++ b/gnorb-gnus.el
@@ -731,20 +731,31 @@ reply."
(defun gnorb-gnus-search-messages (str persist &optional head-text ret)
"Initiate a search for gnus message links in an org subtree.
The arg STR can be one of two things: an Org heading id value
-\(IDs should be prefixed with \"id+\"\), in which case links will
+\(IDs should be prefixed with \"id+\"), in which case links will
be collected from that heading, or a string corresponding to an
Org tags search, in which case links will be collected from all
matching headings.
In either case, once a collection of links have been made, they
will all be displayed in an ephemeral group on the \"nngnorb\"
-server. There must be an active \"nngnorb\" server for this to
-work."
+server. There must be an active \"nngnorb\" server for this to
+work.
+
+If PERSIST is non-nil, make a permanent group, and offer
+HEAD-TEXT, if present, as its name. Otherwise create an
+ephemeral one, with RET as the value of its quit-config."
(interactive)
(require 'nnir)
(let* ((nnir-address
(or (catch 'found
- (dolist (s gnus-server-method-cache)
+ ;; Try very hard to find the server.
+ (when (assoc 'nngnorb gnus-secondary-select-methods)
+ (throw 'found
+ (format
+ "nngnorb:%s"
+ (nth 1 (assoc 'nngnorb
+ gnus-seconard-select-methods)))))
+ (dolist (s (append gnus-server-alist gnus-server-method-cache))
(when (eq 'nngnorb (cadr s))
(throw 'found (car s)))))
(user-error
@@ -756,8 +767,10 @@ work."
(concat "gnorb-" str)))
(method (list 'nnir nnir-address))
(spec (list
- (cons 'nnir-specs (list (cons 'nnir-query-spec `((query .
,str)))
- (cons 'nnir-group-spec `((,nnir-address
,(list name))))))
+ (cons 'nnir-specs (list (cons 'nnir-query-spec
+ `((query . ,str)))
+ (cons 'nnir-group-spec
+ `((,nnir-address ,(list name))))))
(cons 'nnir-artlist nil))))
(if persist
(progn