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: Sat, 04 Jan 2025 23:34:10 +0200 Message-ID: <46402.4568720319$1736026524@news.gmane.org> References: <8634i0ia6l.fsf@gnu.org> <86o70md819.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="30721"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 75305@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 04 22:35: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 1tUBnh-0007rU-Cc for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Jan 2025 22:35:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUBnT-0005iR-Qj; Sat, 04 Jan 2025 16:35: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 1tUBnS-0005ho-ND for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 16:35:02 -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 1tUBnS-0007jP-DS for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 16:35: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=wZY8jbnCun+/HnElBCt2ItpGPfla1cyi8/ZD37WvB+Y=; b=MoMwKL2zG8rOCJmRhAmQKo2XB73jcUiNhKqh5fEHRAZFBHqqyGwtzkOdfNX9hEJrPe55J+X4p8J9/rf36kbhHZBzNVMZoE2qdfKByVdffyhS5kAXybTfuiE4BobZkAHJNuav8vd81ezP4cGM84JoPSI1XmdDikIuRGECqXzdf9tyholGtjoIGxcYyFmUgorfTkxMidPEhTYMuxMjMOpro25EX3zPpwEcBZpMqN/IFXpNh2o1JJkVLNrBP9H58Momq713judisMxE4S331lGieDPY0429NM6VlHA2UodROyFmN562LgGcvtg8bEvPxF+/uTaY8h9A+ivrDwst/3ELJA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tUBnS-0006Cb-7Z for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 16:35: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: Sat, 04 Jan 2025 21:35: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.173602646023779 (code B ref 75305); Sat, 04 Jan 2025 21:35:02 +0000 Original-Received: (at 75305) by debbugs.gnu.org; 4 Jan 2025 21:34:20 +0000 Original-Received: from localhost ([127.0.0.1]:57718 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tUBml-0006BS-9u for submit@debbugs.gnu.org; Sat, 04 Jan 2025 16:34:19 -0500 Original-Received: from thaodan.de ([185.216.177.71]:55328) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tUBmj-0006BD-AM for 75305@debbugs.gnu.org; Sat, 04 Jan 2025 16:34:18 -0500 Original-Received: from odin (dsl-trebng12-50dc7b-49.dhcp.inet.fi [80.220.123.49]) by thaodan.de (Postfix) with ESMTPSA id 010F1D0002E; Sat, 4 Jan 2025 23:34:10 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail; t=1736026451; bh=EkGiAX/4Vez+uKt3O2YgQWHyMLhkZtAT5ubRoKKEFf8=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=bvqx96WkREamsTQaIwRfv2U/rTsrxpOO6P8CcDsecL98GU7EUBE2XEoPEtGsiQnnX XjWzHnsREDmEJlFuUKAdCAoLHUxpdStyaExHdkT37c21y3cUQDhQxlc2LV8aFUT801 BNaTG4AQvlPrRC2UzqScgLrwwuyE9ZABVk11o5kHrVetKesZiUjvy1/pCFCGTi4E6V hjvf5jA3w5a6p1nKEd98iTI9cU/daRwfngSkkNCC9gB0x6mxV8Kza5WHtTnt2jwlMP yXS1kXmAOsVgMaoqZXS6tPZXnUf3UewzbJuz4HCHXszhUHgSohng3N/RFTgqMFxwND fHAB0J2c7zyVK1Bo35BKnADE1KvTVdgutdca8/26OFurBT81FawXNE/tR/BNfbVq+i JjJ6yP2HUVe/AfKqS3pieg6or2UFUrwHsV6ktJzkY7ZzzAvMe++S/uVjYo7Sd/jd5X CCDuiKA2nib28YKIFsi7JUiycHXviK/33LNxN4Temc2RIYMzh+ZoYTCPh9bEDIODZL TqUoxZPowlsS1a8JoxBSEBetMF+cqEj9Yqu0UpXflX9E3pgvjPrP/wOeT/3p6sbMuh uFqacMOuL37itPvG48l3OWq//3JrjrvlLWRAEasDQdRjtAFtgTYgvWSVbojC9RN00R IZWxML0SUtkGrSfOAmBrvllc= In-Reply-To: <86o70md819.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 04 Jan 2025 15:26:42 +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:298479 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: Bj=C3=B6rn Bidar >> Cc: 75305@debbugs.gnu.org >> Date: Fri, 03 Jan 2025 22:33:34 +0200 >>=20 >> Eli Zaretskii writes: >>=20 >> >> Date: Fri, 03 Jan 2025 01:36:19 +0200 >> >> From: Bj=C3=B6rn Bidar via "Bug reports for GNU Emacs, >> >> the Swiss army knife of text editors" >> >>=20 >> >>=20 >> >> 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 howeve= r I >> >> think the description is not exact enough. >> >>=20 >> >> 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? >>=20 >> 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. >>=20 >> 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 a= nd >> explain the option better. > > Thanks, but the patch seems to include unrelated changes in the code? > I thought we were talking only about fixing the manual? Or what did I > miss? > I look at the situation further and noticed that adding the current group does not work without the user writing a custom hook to add it. I already wrote a hook to change gnus-refer-thread-use-search for another reason, to add the current gnus-message-archive-group to=20 gnus-refer-thread-use-search. To just add the current group writing a hook would be to clumsy. Using the current symbol similar as in gnus-refer-article-method is much simpler, makes the setting easier to understand and customize for new=20 users. The customization changes are there to use better custom types which makes it easier to customize and harder to put false values into the option when using custom. > Also, please be sure to leave two spaces between sentences, per our > conventions. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Refactor-gnus-refer-thread-use-search.patch >From 56c0543bb10d7523ca14d5456a1ade37c9c1f6dc 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 | 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..6ac57a8c463 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 --=-=-=--