Subject: Re: bug#75305: 31.0.50; gnus-refer-thread-use-search isn't exact enough about how the current group is searched

From: Andrew Cohen <[email-masked]>
Date: Mon, 03 Feb 2025 18:50:37 +0800

>>>>> "BB" == Björn Bidar <[email-masked]> writes:

[...]

    BB> That look about right. What wasn't correct about the code?

I shouldn't have said the code wasn't correct---its fine, but it just
does something slightly different. When coming from an nnselect group
the default in thread referral is to search the group that contains the
originating article. (This is the "artgroup" in the code that I sent,
rather than "group").

The defcustom looks good and the documentation changes are a big
improvement. I've suggested a few minor stylistic changes

diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 81acb16b7af..2ae23850bf8 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -145,15 +145,21 @@ 'gnus-refer-thread-use-nnir
 (defcustom gnus-refer-thread-use-search nil
   "Specify where to find articles when referring threads.
 A nil value restricts searches for thread-related articles to the
-current group; a value of t searches all groups on the server; a
-list of servers and groups (where each element is a list whose
-car is the server and whose cdr is a list of groups on this
-server or nil to search the entire server) searches these
-server/groups.  This may usefully be set as a group parameter."
-  :version "28.1"
+current group; a value of t searches all groups on the server to which
+the group belongs; a list of servers and groups (where each element is a
+list whose car is the server and whose cdr is a list of groups on this
+server, or nil to search the entire server) searches just these
+server/groups.
+
+The list of server/groups may contain the symbol `current' which
+includes the current group in the list of those searched."
+  :version "31.1"
   :group 'gnus-thread
-  :type '(restricted-sexp :match-alternatives
-                          (listp 't 'nil)))
+  :type '(choice (const :tag "Current group" nil)
+                 (const :tag "All groups" t)
+                 (repeat :tag "Server and groups"
+                         (choice (const :tag "Current Group" current)
+                                 (repeat :tag "Server and groups" string)))))
 
 (defcustom gnus-refer-thread-limit-to-thread nil
   "If non-nil referring a thread will limit the summary buffer to

diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 404f6b069ef..4c9b48350f3 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -10546,8 +10546,7 @@ Finding the Parent
 @findex gnus-summary-refer-thread
 @kindex A T @r{(Summary)}
 Display the full thread where the current article appears
-(@code{gnus-summary-refer-thread}).  By default this command looks for
-articles only in the current group.  If the group belongs to a backend
+(@code{gnus-summary-refer-thread}).  If the group belongs to a backend
 that has an associated search engine, articles are found by searching.
 In other cases each header in the current group must be fetched and
 examined, so it usually takes a while.  If you do it often, you may
@@ -10557,12 +10556,21 @@ Finding the Parent
 course, it'll make group entry somewhat slow.
 
 @vindex gnus-refer-thread-use-search
-If @code{gnus-refer-thread-use-search} is @code{nil} (the default)
-then thread-referral only looks for articles in the current group.  If
-this variable is @code{t} the server to which the current group
-belongs is searched (provided that searching is available for the
-server's backend).  If this variable is a list of servers, each server
-in the list is searched.
+If @code{gnus-refer-thread-use-search} is @code{nil} (the default), then
+thread-referral only looks for articles in the current group.
+
+If this variable is @code{t}, and the server to which the current group
+belongs has an associated search engine, then this server is searched.
+
+This variable may also be a list of servers and groups to search. Each
+element of the list is of the form @code{(@var{server} @var{group1}
+@var{group2}@dots{})}, where @var{server} is the server and
+@var{group1}, @var{group2}@dots{} are the groups belonging to this
+server that are to be searched.  If the @var{group}s are absent the
+entire server is searched.
+
+This list may also contain the special symbol @code{current}, which will
+add the current group to the list of groups to be searched.
 
 @vindex gnus-refer-thread-limit
 The @code{gnus-refer-thread-limit} variable says how many old (i.e.,

Best,
Andy
-- 
Andrew Cohen