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#74905: [PATCH] Implement search for nnvirtual Gnus groups Date: Sun, 22 Dec 2024 22:48:05 +0200 Message-ID: <31754.6660824277$1734900575@news.gmane.org> References: <86zfktesxb.fsf@gmx.net> <87bjx96ln5.fsf@thaodan.de> <86pllozkq4.fsf@gmx.net> <86ldwcziff.fsf@gmx.net> <87y10c1p21.fsf@thaodan.de> <86v7ve9658.fsf@gmx.net> <86pllkj6d8.fsf@gmx.net> Reply-To: =?UTF-8?Q?Bj=C3=B6rn?= Bidar Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38297"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 74905@debbugs.gnu.org To: James Thomas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 22 21:49:27 2024 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 1tPStC-0009kA-Je for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Dec 2024 21:49:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tPSsr-0002aF-Ed; Sun, 22 Dec 2024 15:49:05 -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 1tPSsp-0002Zn-1E for bug-gnu-emacs@gnu.org; Sun, 22 Dec 2024 15:49: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 1tPSso-0001eJ-P4 for bug-gnu-emacs@gnu.org; Sun, 22 Dec 2024 15:49: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=z4YoQvQP2czadkdV0Th0qAOrhEHwq4qw3kQPcTc2jZE=; b=hpHp8zPg3GOk8XNXNJS+hUhiWZ6SZx0naV8PHDeUDFXQ9RhoF72tM7b01aRBYUyWi+BGQw0u3ldeG76IEVJG/7YfWPOgr0bpU/LaTbzC5t9KvdEXkXeFCD9HALFdQ87AR5hgCkXhm8jKJeb2Z63HNT+z3fSMr/8EF7Eh2rfam7YnbqrmhIMGBZwzHJ0h4POF0hPhTeNufynsCjYBndxhoku/svI6zgI2j74BCvlyilLaUhIMWUQ78jfZhZqoWmqbeZOw/p3/PUr2zFd/swg/oKDVhGg0GWNEP0lMUro6pzyxtHyxW8E12HEjE8TwQoVTZzcuH9vUGuMgTun7FoO0dw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tPSso-0000Zj-8g for bug-gnu-emacs@gnu.org; Sun, 22 Dec 2024 15:49: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, 22 Dec 2024 20:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74905 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74905-submit@debbugs.gnu.org id=B74905.17349004972149 (code B ref 74905); Sun, 22 Dec 2024 20:49:02 +0000 Original-Received: (at 74905) by debbugs.gnu.org; 22 Dec 2024 20:48:17 +0000 Original-Received: from localhost ([127.0.0.1]:52122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPSs4-0000Ya-OD for submit@debbugs.gnu.org; Sun, 22 Dec 2024 15:48:17 -0500 Original-Received: from thaodan.de ([185.216.177.71]:55414) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPSs1-0000YH-Iq for 74905@debbugs.gnu.org; Sun, 22 Dec 2024 15:48:15 -0500 Original-Received: from odin (dsl-trebng12-50dc7b-49.dhcp.inet.fi [80.220.123.49]) by thaodan.de (Postfix) with ESMTPSA id DEEB9D0005B; Sun, 22 Dec 2024 22:48:06 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail; t=1734900487; bh=KF9aqtGbVrcO/9qfHOYxIAa6xqWUQca4Mw+X1lpY/Gg=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=ObINmp/LPBkv0Hsmjf3ghPmmqDY5AYATHx+pUoYF5K3VZnNBzyZi/XxK8TKbNyAuZ LUm25n6hgpxZaYif7zxMoIHhEW29bqvk13PGBr0xeXD71OHTWkXn7Mjsvu8V7Lmxlk TjAkiSd+DfJjzO7n/Y2zrhfUXovpFcYMAUm9P1iE7G4Kzps/ztkt/n31vFeseboU6g AM3zfSmQA2mKcT2IoP0YjuHB1EozuPICOTa2dHs9MvvdmP505ivm3C0+LiGOMDZcIU iMIpzlighaGIRxPcwyxGqDdFLgkGZdcoJ9/cBdZS2OYZhIyYsyV7Fn04mZr8sNjlsJ TH8ozSdlN0oxHP9heuoLLMuXY8/lq/xBZYjmeA9TM/VehHu47n8MdLhxOkdLdGeN9C xXh9cg8NbvhcgKgCwK8MthPRhrBF7eb7ZehpN+Tff/jVPBOfk8cRvWk1sn+Twluyz/ 1uZHxRt7rZtToZreqDELOzxxa68fbO4ljYz/vDbVgPgkckhNK/b++Q2n3j+KbZz0TX k5G5bqe8yBQm50OyMEkm934Cc4w2p58S5Y3RYo0r/LDhaJOXM+irN2kTqlnbjHdoin JR/q6xhxVCGi9LHiLK5P5+/T7hKLXe4QlMLI8nxoBiE7qqWAt8b49BdVNDvGEKAQpC lZW6Um13ishLQguBNNpvIMd4= In-Reply-To: <86pllkj6d8.fsf@gmx.net> (James Thomas's message of "Sun, 22 Dec 2024 17:07:39 +0530") 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:297628 Archived-At: James Thomas writes: > Bj=C3=B6rn Bidar wrote: > >> James Thomas writes: >> >>> Bj=C3=B6rn Bidar wrote: >>> >>>> James Thomas writes: >>>> >>>>> James Thomas wrote: >>>>> >>>>>> Bj=C3=B6rn Bidar wrote: >>>>>> >>>>>>> James Thomas writes: >>>>>>> >>>>>>>> Bj=C3=B6rn Bidar wrote: >>>>>>>> >>>>>>>>> This patch implements search for nnvirtual. I'm using >>>>>>>>> publi-inbox's >>>>>>>>> with nnvirtual to group each group into one. >>>>>>>>> However searching wasn't possible in these nnvirtual groups. >>>>>>>>> I implemented gnus-search-run-search based on the existing >>>>>>>>> nnselect gnus-search-run-search function. >>>>>>>> >>>>>>>> Thanks! I haven't looked into it, but here are some quick comments: >>>>>>>> >>>>>>>>> I'm looking for feedback on the patch. I don't exactly know how >>>>>>>>> the search function is called when multiple groups of the same >>>>>>>>> type >>>>>>>>> are >>>>>>>>> involved. For nnvirtual each group is its on server, does that >>>>>>>>> mean >>>>>>>>> the >>>>>>>>> function will be always called only for each group? In that case >>>>>>>>> everything should be good. >>>>>>>> >>>>>>>> That seems to be the case: see >>>>>>>> gnus-group-read-ephemeral-search-group >>>>>>>> and gnus-group-make-search-group. >>>>>>> >>>>>>> OK good than my understanding from my tests matched with the rest of >>>>>>> the >>>>>>> code. >>>>>>> Thanks for these examples I haven't looked at the create group >>>>>>> functions >>>>>>> as the searched methods don't have to create groups even when they >>>>>>> start >>>>>>> a new search by another backend just like e.g. if the user would >>>>>>> call >>>>>>> a >>>>>>> search on another imap group. >>>>>>> >>>>>>>>> +(deffoo nnvirtual-request-list (&optional server) >>>>>>>>> + (when (nnvirtual-possibly-change-server server) >>>>>>>>> + (with-current-buffer nntp-server-buffer >>>>>>>>> + (erase-buffer) >>>>>>>>> + (dolist (group nnvirtual-component-groups) >>>>>>>>> + (insert (format "%S 0 1 y\n" group)))) >>>>>>>>> + t)) >>>>>>>> >>>>>>>> Did you check if gnus-start.el#L1801 withstands this? It seems to >>>>>>>> me >>>>>>>> to >>>>>>>> assume that nnvirtual doesn't have -request-list. >>>>>>> >>>>>>> It does. If the user has falsely add nnvirtual to one of the select >>>>>>> methods than it will call it try to call the function which doesn't >>>>>>> fail >>>>>>> or do anything. The only thing that happens from that is it will >>>>>>> show >>>>>>> the false results as groups contained in the nnvirtual method >>>>>>> without >>>>>>> a >>>>>>> parameter. >>>>>> >>>>>> No, I mean, the point of that code seems to be that nnvirtual is >>>>>> activated _last_, i.e. after any component groups of other backends. >>>>> >>>>> No, sorry, I was a little confused about this. But it seems to me that >>>>> -request-group removes each group from the component list (unlike your >>>>> -request-list). Is that relevant? IDK. The latter seems to do info >>>>> updation as well, based on -always-rescan. >>>>> >>>> >>>> Request list supposed to list the available groups on the server it is >>>> also for example used in gnus-search-imap class gnus-search-run-search >>>> function. Since for the case of nnvirtual all groups on the server >>>> are all groups contained in the group it is the right function. >>> >>> True, but since it returns the group data like -request-group and often >>> acts as a _substitute_, shouldn't it mimic its operation? If not, is >>> there a good reason? >> >> It does mimic it's operation or doesn't it? > > I mean, I was asking if it _should_ or not. I think it would be a good > idea to get some 'grep'ed evidence of code coverage that -request-list > would not supplant the intentions of -request-group. To verify my earlier thoughts and have an example I tested this. -request-group functions are for retrieving the metedata of the group and possibly update the existing metata against the new one. -request-list function list all groups on the server with possibly the status of group e.g. killed, zombie or none if subscribed, the highest amount of articles and the group name. The latter is the one we need. >>>> I took all the explenation for each functions purpose from the manual >>>> section linked below: >>>> (info "(gnus) Required Back End Functions") >>> >>> Please do look at how they're called, as well; for a fuller picture. >>> >>>> To me the code just reads like that that for nnvirtual >>>> the groups are activated this way only because >>>> it doesn't have request list. >>>> >>>>> >>>>> No, I mean, the point of that code seems to be that nnvirtual is >>>>> activated _last_, i.e. after any component groups of other backends. = And >>>>> it's not just select methods: even Foreign Groups are included, no? >>>>> >>>>>> Should verify that nnvirtual has arguments? So far it is possible >>>>>> to add nnvirtual to select methods with "" but this is invalid. >>>>> >>>>> I'm not sure what you mean, but it does have arguments: the components >>>>> regexp, for one. >>>>> >>>> >>>> It does have arguments exactly but you can add nnvirtual without >>>> arguments or technically an empty argument to select methods. >>>> >>>>>> If nnvirtual isn't added to select methods nothing happens besides >>>>>> the regular activation. >>>>> >>>>> Couldn't someone have added one? Say, with the above argument? >>>> >>>> I guess so but that isn't the intended way of using nnvirtual, >>>> also it wouldn't take care of the request of the setup such >>>> as creating the associated group. >>> >>> Well now you've made me look at it... :-) >>> >>> Try this: >>> >>> - In *Groups*: j nnvirtual:Test RET >>> - S l 3 RET >>> - e "nnvirtual:Test" C-c C-c >>> - q >>> - Add to -secondary-select-methods: >>> >>> (nnvirtual "Test" >>> (nnvirtual-component-regexp >>> ;; Put in some group you have. >>> "^$\\|\\(^nnml\\+archive:sent$\\)")) >>> >>> M-x gnus >>> >>>> Regular activation meant in this context that the request-list function >>>> is called but without a argument the nnvirtual-server doesn't contain >>>> any groups. >>> >>> OK. But I don't think I've come across that term. >>> >>> Also, your -request-list makes the component groups subscribable from >>> the Server buffer. That seems wrong too: the backend ought to have only >>> one (umbrella) group, no? > >> It only has one group containing other groups yes. The backend is not >> supposed to end up in the Server but is only there if it falsely was >> added to the select-methods. >> >> Anyway I need a backtrace from the case where the search did not work >> with nnml groups. > > No no, you misunderstand me: It was just to demonstrate that: > >> that isn't the intended way of using nnvirtual > > ...can't be said. So please re-verify anything (there might've been) > about the patch predicated on that. I did not encounter errors. > > I know you're exploiting the fact that the server and group are one, but > perhaps it's being too clever by half. Any such unintended effects of > that easy road ought to be acceptable to other users. Yeah that's why I posted the patch here so more can try it with different setups. A review from a Gnus maintainer or contributor would also be awesome.