From: "Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 75305@debbugs.gnu.org
Subject: bug#75305: 31.0.50; gnus-refer-thread-use-search isn't exact enough about how the current group is searched
Date: Fri, 03 Jan 2025 22:33:34 +0200 [thread overview]
Message-ID: <6323.37372969545$1735936470@news.gmane.org> (raw)
In-Reply-To: <8634i0ia6l.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 03 Jan 2025 10:16:50 +0200")
[-- Attachment #1: Type: text/plain, Size: 1035 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> Date: Fri, 03 Jan 2025 01:36:19 +0200
>> From: Björn Bidar via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>
>>
>> I noticed that as intended without adding the current group to the
>> variable in addition to the current group.
>> The manual states what happens what the variable does when set however I
>> think the description is not exact enough.
>>
>> It is very easy to overlook that to add the current group in addition
>> other groups it has to be added too.
>
> Can you suggest the additions to the manual?
I can. I compared the option to another gnus-refer-article-method one
which has the option to include the symbol current to include the curren
t method.
I added the same symbol to gnus-refer-thread-use-search to add the
current group including the other groups to the list of possible groups
to search through. I adjusted the manual to include the current symbol and
explain the option better.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Refactor-gnus-refer-thread-use-search.patch --]
[-- Type: text/x-patch, Size: 7766 bytes --]
From 8b7dc8441294a42eb4132f7a978cf28580791278 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <bjorn.bidar@thaodan.de>
Date: Fri, 3 Jan 2025 04:09:55 +0200
Subject: [PATCH] Refactor gnus-refer-thread-use-search
* lisp/gnus/gnus-sum.el (gnus-refer-thread-use-search):
Make it easier to customize the variable by adding predefine choices
as well as descriptions to each choice. Add option to add the value
`current' to the list of servers and groups to add the current group.
E.g. to add another group and the current group.
* lisp/gnus/gnus-search.el (gnus-refer-thread-maybe-add-current-group,
gnus-search-thread): Add helper function to determine if the option
contains the value current. Use helper function.
* lisp/gnus/nnselect.el (nnselect-request-thread): Use helper function
to check if the value current is in gnus-refer-thread-use-search.
* doc/misc/gnus.texi (gnus-refer-thread-use-search):
Include the current value in the section. Format the section a little
better to have a paragraph for each possible value that the option
may contain. Explain the option to have a list of servers more detailed
, i.e. similarly to the custom description. Highlight that the current
group is not searched unless specified. Explain that unless the articles
of that thread are contained in the searched groups not adding the
current group might not be the desired effect.
---
doc/misc/gnus.texi | 23 +++++++++++++++++------
lisp/gnus/gnus-search.el | 24 +++++++++++++++++++++---
lisp/gnus/gnus-sum.el | 17 +++++++++++++----
lisp/gnus/nnselect.el | 4 ++--
4 files changed, 53 insertions(+), 15 deletions(-)
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 200b68d2059..5b2d5a8ea04 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -10557,12 +10557,23 @@ 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{current} or @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. Note this is only possible provided that searching
+is available for the server's backend.
+
+The variable can also be a list of server each server
+in the list is searched. The servers have to specified in a list
+where the first element of this has to be the server and any remaining elements
+can be the groups belonging to that server.
+
+To search in the current group in addition to other groups the list of servers
+may contain the symbol @code{current}.
+If @code{current} is not in the list the current group is not searched,
+note this may be not the desired effect if any of articles referred in
+the thread are not contained in any of the searched groups.
@vindex gnus-refer-thread-limit
The @code{gnus-refer-thread-limit} variable says how many old (i.e.,
diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el
index 12af8dcdfa7..e61df436c80 100644
--- a/lisp/gnus/gnus-search.el
+++ b/lisp/gnus/gnus-search.el
@@ -2206,6 +2206,23 @@ gnus-search-server-to-engine
(declare-function gnus-registry-get-id-key "gnus-registry" (id key))
+(defun gnus-refer-thread-maybe-add-current-group (group)
+ "Find if GROUP should be added to `gnus-refer-thread-use-search'."
+ (cond ((eq 'current gnus-refer-thread-use-search)
+ (list (gnus-info-method (gnus-get-info group))
+ group))
+ ((listp gnus-refer-thread-use-search)
+ (let (out)
+ (dolist (search gnus-refer-thread-use-search)
+ (push (if (and (not (listp search)) (eq 'current search))
+ (list (gnus-info-method (gnus-get-info group))
+ group)
+ search)
+ out))
+ out))
+ (t
+ nil)))
+
(defun gnus-search-thread (header &optional group server)
"Find articles in the thread containing HEADER from GROUP on SERVER.
If `gnus-refer-thread-use-search' is nil only the current group is
@@ -2227,7 +2244,8 @@ gnus-search-thread
" or "))
(cons 'thread t)))
(gnus-search-use-parsed-queries t))
- (if (not gnus-refer-thread-use-search)
+ (if (or (not gnus-refer-thread-use-search)
+ (eq 'current gnus-refer-thread-use-search))
;; Search only the current group and send the headers back to
;; the caller to add to the summary buffer.
(gnus-fetch-headers
@@ -2247,8 +2265,8 @@ gnus-search-thread
(thread (gnus-search-run-query
(list (cons 'search-query-spec query)
(cons 'search-group-spec
- (if (listp gnus-refer-thread-use-search)
- gnus-refer-thread-use-search
+ (or (gnus-refer-thread-maybe-add-current-group
+ group)
(list (list server))))))))
(if (< (nnselect-artlist-length thread) 2)
(message "No other articles in thread")
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index a9caa83b15c..2119235bc2e 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -149,11 +149,20 @@ gnus-refer-thread-use-search
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"
+server/groups.
+
+The list of of server and groups may contain
+the symbol `current' to refer to the current group.
+For example to search in the current group in addition to other groups.
+
+This may usefully be set as a group parameter."
+ :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/lisp/gnus/nnselect.el b/lisp/gnus/nnselect.el
index c6a1c0a9342..9d55ac27b98 100644
--- a/lisp/gnus/nnselect.el
+++ b/lisp/gnus/nnselect.el
@@ -49,6 +49,7 @@
(require 'gnus-art)
(autoload 'gnus-search-run-query "gnus-search")
(autoload 'gnus-search-server-to-engine "gnus-search")
+(autoload 'gnus-refer-thread-maybe-add-current-group "gnus-search")
(eval-when-compile (require 'cl-lib))
@@ -707,8 +708,7 @@ nnselect-request-thread
(group-spec
(if (not gnus-refer-thread-use-search)
(list (list server artgroup))
- (if (listp gnus-refer-thread-use-search)
- gnus-refer-thread-use-search
+ (or (gnus-refer-thread-maybe-add-current-group group)
(list (list server)))))
(ids (cons (mail-header-id header)
(split-string
--
2.45.2
next prev parent reply other threads:[~2025-01-03 20:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87wmfclrf0.fsf@>
2025-01-03 8:16 ` bug#75305: 31.0.50; gnus-refer-thread-use-search isn't exact enough about how the current group is searched Eli Zaretskii
2025-01-03 20:33 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
[not found] ` <87o70nd4dd.fsf@>
2025-01-04 13:26 ` Eli Zaretskii
2025-01-04 21:34 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
[not found] ` <87bjwmw9f1.fsf@>
2025-01-05 6:29 ` Eli Zaretskii
2025-01-05 20:33 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
[not found] ` <87o70lt2yw.fsf@>
2025-01-05 20:36 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-02 23:36 Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='6323.37372969545$1735936470@news.gmane.org' \
--to=bug-gnu-emacs@gnu.org \
--cc=75305@debbugs.gnu.org \
--cc=bjorn.bidar@thaodan.de \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).