From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Bj=C3=B6rn?= Bidar via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#75305: 31.0.50; gnus-refer-thread-use-search isn't exact enough about how the current group is searched Date: Sun, 05 Jan 2025 22:36:13 +0200 Message-ID: <34312.2894338862$1736109445@news.gmane.org> References: <8634i0ia6l.fsf@gnu.org> <86o70md819.fsf@gnu.org> <86wmf9ai4k.fsf@gnu.org> Reply-To: =?UTF-8?Q?Bj=C3=B6rn?= Bidar Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34688"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eric Abrahamsen , 75305@debbugs.gnu.org, Andrew G Cohen To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 05 21:37:18 2025 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tUXN8-0008t1-1z for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Jan 2025 21:37:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUXMu-0004zr-8E; Sun, 05 Jan 2025 15:37:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tUXMt-0004zg-4D for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 15:37:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tUXMs-0005fT-Ov for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 15:37:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=ZJFDWxS+sfe8uzDM5W1QNEeQKztvxjb827+3TfJcotw=; b=cbwI97iAEEaU8bPdqkXjx59Cgk97RsH/L8I9yBfYsfw/KMskjTzbhyhR0Fud5HXKhoyVD2tonG5/FVNJjyg9NAWQVXn65eLf9WSLthUW2fj4cd6BHhTOs32IsXijJCrGtJpw3jN4JOKXZMuT2rJ5MRO3NRKno1zO0IzAJ4vc9gLwCKE3gRgOYBjSnJ1eVhh/DVNIYrj+n+CTZpxo5waBMBTj7gT6/mtghuK7Rf9Qa019Qje6wGM+ICsnyslGe7Kh6KeCo1FI1iOyZEnQ5gGIkKS3at7LsQ6pHkH43MN2OHb8tBByTQ/So+TkrU4nFmZzV/41DcdYZ4pB85O/Jqjncw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tUXMs-00009Z-JG for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 15:37:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Bj=C3=B6rn?= Bidar Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Jan 2025 20:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75305 X-GNU-PR-Package: emacs Original-Received: via spool by 75305-submit@debbugs.gnu.org id=B75305.1736109383520 (code B ref 75305); Sun, 05 Jan 2025 20:37:02 +0000 Original-Received: (at 75305) by debbugs.gnu.org; 5 Jan 2025 20:36:23 +0000 Original-Received: from localhost ([127.0.0.1]:35431 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tUXME-00008J-DR for submit@debbugs.gnu.org; Sun, 05 Jan 2025 15:36:22 -0500 Original-Received: from thaodan.de ([2a03:4000:4f:f15::1]:40732) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tUXMC-00007u-6e for 75305@debbugs.gnu.org; Sun, 05 Jan 2025 15:36:20 -0500 Original-Received: from odin (dsl-trebng12-50dc7b-49.dhcp.inet.fi [80.220.123.49]) by thaodan.de (Postfix) with ESMTPSA id 2A236D00098; Sun, 5 Jan 2025 22:36:14 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail; t=1736109374; bh=/VNL2ypx5ZTiXbXma47+mSGJV2eSAc+ygIz30o7jNc0=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=C0pw+uDXtzC11Gv9UQREn9Wq07MdQjnn5SO/9bTG6zXxYBtJ5K3KQaRcbKWGUwRu4 d0YFj8xp+QW7VYA8urRZI6GaPltxP90FlNm1jvu24RV2pLL2ROd0CRgmOacrQ8ZJBf ASjf+J+eUvEC4BKtpUCba3nOT2mu10cKdQaqP0YhySes+VZlh7hDmGm9wtMb8D6yS8 Vl+0RMGUlKmodwgpRVuEyvUkK72lI3EUoOQKHDHh0gxftTRKVmoSewF9QQG0PuJQkt SB6v4H9qUz7AG8448AT2dR1drhn7/R4J4lZt9fCeNRymgGbQRrN9VZMbLGZfGgVTHd t6EEg19zqEI1BILRnk6yxVJhBHKZp5WaUffLJsta6yu8XX2MftYI4LlgiD7tP3sN/p PmcK7C2XQg2oE+78OdZYCLlnx6eE6hvWHBHUENpRUlG8Qe+yhgi9oQXrzUzyNuCV5z 3/niPpCQlGnx5dUhMIuJfqHPJcliX0F+eT0Jh5NaxOVaVjZ+OIanaCjQE2RWu7R/MN 7s5MzCG4cjYkq0mJVldAsRvNQysclH9zoSki4ANDOks241i9BOWhgCWtEzwIwJTiH9 iHnhmkJ3VQBaBk5hFAdNTdt6AMz/5mQlMDnay9oIbPYojWP7wz/Pbg/KO/YM9GK1rR vqnXb8GsYkq1x0icX4yrQ8Qw= In-Reply-To: <87o70lt2yw.fsf@> ("=?UTF-8?Q?Bj=C3=B6rn?= Bidar"'s message of "Sun, 05 Jan 2025 22:33:59 +0200") Autocrypt: addr=bjorn.bidar@thaodan.de; prefer-encrypt=nopreference; keydata= mDMEZNfpPhYJKwYBBAHaRw8BAQdACBEmr+0xwIIHZfIDlZmm7sa+lHHSb0g9FZrN6qE6ru60JUJq w7ZybiBCaWRhciA8Ympvcm4uYmlkYXJAdGhhb2Rhbi5kZT6IlgQTFgoAPgIbAwULCQgHAgIiAgYV CgkICwIEFgIDAQIeBwIXgBYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1/YmAhkBAAoJEFwbdKFl HF9oB9cBAJoIIGQKXm4cpap+Flxc/EGnYl0123lcEyzuduqvlDT0AQC3OlFKm/OiqJ8IMTrzJRZ8 phFssTkSrrFXnM2jm5PYDoiTBBMWCgA7FiEEUfF263VHMB6nKairXBt0oWUcX2gFAmTX6T4CGwMF CwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQXBt0oWUcX2hbCQEAtru7kvM8hi8zo6z9ux2h K+B5xViKuo7Z8K3IXuK5ugwA+wUfKzomzdBPhfxDsqLcEziGRxoyx0Q3ld9aermBUccHtBxCasO2 cm4gQmlkYXIgPG1lQHRoYW9kYW4uZGU+iJMEExYKADsCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwEC HgcCF4AWIQRR8XbrdUcwHqcpqKtcG3ShZRxfaAUCZNf2FQAKCRBcG3ShZRxfaCzSAP4hZ7cSp0YN XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlH X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:298609 Archived-At: --=-=-= Content-Type: text/plain I forgot to attach the update patch, see below: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Refactor-gnus-refer-thread-use-search.patch >From 8cd116f25411575fb8ad59e08ba1cde8f7d7ae12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= 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 | 25 ++++++++++++++++++++++--- lisp/gnus/gnus-sum.el | 17 +++++++++++++---- lisp/gnus/nnselect.el | 4 ++-- 4 files changed, 54 insertions(+), 15 deletions(-) diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 200b68d2059..2e9959aeaf0 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 value can also be a list of the form +@code{(@var{server} @var{group}@dots{})}, where @var{server} is the +server and @var{group}s are the groups belonging to the 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..959984c2ca4 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -2206,6 +2206,24 @@ 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) + "Return `gnus-refer-thread-use-search' with `current' replaced by GROUP. +Return nil if `current' was not found or if was not a list." + (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 +2245,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 +2266,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..107e52ab8ef 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 --=-=-=--