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,gmane.emacs.gnus.general Subject: bug#74905: [PATCH] Implement search for nnvirtual Gnus groups Date: Mon, 16 Dec 2024 01:55:37 +0200 Message-ID: <11287.5293287047$1734307174@news.gmane.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="4234"; mail-complaints-to="usenet@ciao.gmane.io" Cc: ding@gnus.org To: 74905@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 16 00:59:25 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 1tMyWC-0000vA-JQ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Dec 2024 00:59:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tMyVu-0005BZ-7I; Sun, 15 Dec 2024 18:59:06 -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 1tMyVs-0005BQ-Ht for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2024 18:59:05 -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 1tMyVs-0001Fx-2E for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2024 18:59:04 -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:From:To:Subject; bh=qK9yqTR8n9nM3YuuXp4ycKIgmYJepPNL7Z4CkljTn7A=; b=Juz6HeOnv1wcTjfjm7+7dXtzV1gNhY3YJpg2oEZPXRul9SKFNnEsfSpG1UBe5qr1lw+JbDQ2msV+JElLYlj9ZnyzFSSi/XxdKuL/51lU76Yt0yABmCFDdWhjkHrHFl5DtlsBPMqgdAD+ukTWdLL9v7ET2oU6vh2GkqQ7Po9hwU92yPl2KCBKZAsz3wopIydwI10FFjwmdj/PicN6jw+UrwhIbw6ylPIto3jLVR/Sw9c4hlhm5VBNvYTaNrs7lC3x6fxyHKr6jm+a3kwG35Yw9akhs/LdvKSE/+EcW2IzZ/iE2UPYY+rFs70U0lcU/sBE9vrb92OAXklqyac6pUiv4A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tMyVq-00039w-9O; Sun, 15 Dec 2024 18:59:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Bj=C3=B6rn?= Bidar Original-Sender: "Debbugs-submit" Resent-CC: ding@gnus.org, bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Dec 2024 23:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74905 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: ding@gnus.org Original-Received: via spool by submit@debbugs.gnu.org id=B.173430708912061 (code B ref -1); Sun, 15 Dec 2024 23:59:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Dec 2024 23:58:09 +0000 Original-Received: from localhost ([127.0.0.1]:52676 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tMyUq-00037z-LR for submit@debbugs.gnu.org; Sun, 15 Dec 2024 18:58:08 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:49632) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tMyUn-00037p-6g for submit@debbugs.gnu.org; Sun, 15 Dec 2024 18:57:58 -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 1tMySh-0004xB-JE for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2024 18:55:47 -0500 Original-Received: from thaodan.de ([2a03:4000:4f:f15::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tMySd-00017w-NJ for bug-gnu-emacs@gnu.org; Sun, 15 Dec 2024 18:55:47 -0500 Original-Received: from odin (dsl-trebng12-50dc7b-49.dhcp.inet.fi [80.220.123.49]) by thaodan.de (Postfix) with ESMTPSA id 45609D0008E for ; Mon, 16 Dec 2024 01:55:39 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail; t=1734306939; bh=h7M/N1sB06mMZBdeRZTVoEZMM/iBfBQ9tmF/2Ib6iJ0=; h=From:To:Subject:Date; b=x7rDW6UFE/QCTkclTdLW6pNAgnyMg9PA8+wqQ7oxTGjm5jS9McOjUXOETmlX8KQcx MI1yAtCFocX9f99sphv40APhv7zjhrsFmKCUN1JpMTPqUoVWi6+cgZdgpbT6zPh9QP oRruDl9SVBBeyqJUZjjLCoar7xfGvJZDB0ikqMHosmo71vt8skZeOLkqBulTdotbNY debWDKNoedh0ZxuSBDJ4e5zFM+lD2Em/ebdU+x+Wy+qahHpCl250gl49IkZbycfL+U G5yHiAlK0BoMKN1zoTPOGjsREf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brdUcwHqcpqKtcG3ShZRxfaAUCZNf2FQAKCRBcG3ShZRxfaCzSAP4hZ7cSp0YN XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlH Received-SPF: pass client-ip=2a03:4000:4f:f15::1; envelope-from=bjorn.bidar@thaodan.de; helo=thaodan.de X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, INVALID_MSGID=0.568, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:297149 gmane.emacs.gnus.general:91761 Archived-At: --=-=-= Content-Type: text/plain Tags: patch 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. 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. In GNU Emacs 31.0.50 (build 1, x86_64-suse-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.2) Repository revision: b25fba0ef8f38f95a9e65548f9ebb6c92739857e Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101014 System Description: openSUSE Tumbleweed Configured using: 'configure --disable-build-details --without-pop --with-mailutils --without-hesiod --with-gameuser=:games --with-kerberos --with-kerberos5 --with-file-notification=inotify --with-modules --enable-autodepend --enable-link-time-optimization --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --localstatedir=/var --sharedstatedir=/var/lib --libexecdir=/usr/libexec --with-file-notification=yes --libdir=/usr/lib64 --with-native-compilation=aot --enable-locallisppath=/usr/share/emacs/31.0.50/site-lisp:/usr/share/emacs/site-lisp --with-x --with-xim --with-sound --with-xpm --with-jpeg --with-tiff --with-gif --with-png --with-rsvg --with-dbus --with-xft --without-gpm --with-tree-sitter --with-x-toolkit=gtk --without-pgtk --with-toolkit-scroll-bars --x-includes=/usr/include --x-libraries=/usr/lib64 --with-libotf --with-m17n-flt --with-cairo --build=x86_64-suse-linux --with-dumping=pdumper build_alias=x86_64-suse-linux 'CC=sccache cc' 'CFLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -march=znver3 -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -msse4a -mno-fma4 -mno-xop -mfma -mbmi -mbmi2 -maes -mpclmul -mno-gfni -mvpclmulqdq -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mclwb -mclzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mno-movdir64b -mno-movdiri -mmwaitx -mno-pconfig -mpku -mprfchw -mno-ptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mno-serialize -mno-sgx -msha -mshstk -mno-tbm -mno-tsxldtrk -mvaes -mno-waitpkg -mwbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mno-hreset -mno-kl -mno-widekl -mno-avxvnni -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint -mno-amx-complex --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver3 -fno-optimize-sibling-calls -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -D_GNU_SOURCE -DGDK_DISABLE_DEPRECATION_WARNINGS -DGLIB_DISABLE_DEPRECATION_WARNINGS -pipe -Wno-pointer-sign -Wno-unused-variable -Wno-unused-label -DPDMP_BASE='\''"emacs-gtk"'\''' LDFLAGS=-Wl,-O2 'CXX=sccache c++' PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Implement-search-for-nnvirtual-Gnus-groups.patch >From 4b24c759e19aa2998a150f424e8187b052d7d5e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Mon, 16 Dec 2024 01:28:16 +0200 Subject: [PATCH] Implement search for nnvirtual Gnus groups * lisp/gnus/nnvirtual.el (nnvirtual-request-list): Implement request list backend function for nnvirtual. * lisp/gnus/gnus-search.el (gnus-search-nnvirtual): Implement function to build search queries for nnvirtual. (gnus-search-default-search-engines, gnus-search-server-to-enngine): Include nnvirtual. --- lisp/gnus/gnus-search.el | 29 ++++++++++++++++++++++++++--- lisp/gnus/nnvirtual.el | 7 +++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index ca82546ef82..4a7cf902b32 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -795,6 +795,9 @@ shared-initialize (defclass gnus-search-nnselect (gnus-search-engine) nil) +(defclass gnus-search-nnvirtual (gnus-search-engine) + nil) + (defclass gnus-search-imap (gnus-search-engine) ((literal-plus :initarg :literal-plus @@ -953,14 +956,16 @@ 'nnir-method-default-engines 'gnus-search-default-engines "28.1") (defcustom gnus-search-default-engines '((nnimap . gnus-search-imap) - (nnselect . gnus-search-nnselect)) + (nnselect . gnus-search-nnselect) + (nnvirtual . gnus-search-nnvirtual)) "Alist of default search engines keyed by server method." - :version "26.1" + :version "31.1" :type `(repeat (cons (choice (const nnimap) (const nntp) (const nnspool) (const nneething) (const nndir) (const nnmbox) (const nnml) (const nnmh) (const nndraft) (const nnfolder) (const nnmaildir) - (const nnselect)) + (const nnselect) + (const nnvirtual)) (choice ,@(mapcar (lambda (el) (list 'const (intern (car el)))) @@ -1086,6 +1091,23 @@ gnus-search-run-search (cons 'search-group-spec group-spec)))))))) artlist)) +;; nnvirtual interface +(cl-defmethod gnus-search-run-search ((_engine gnus-search-nnvirtual) + srv query-spec _groups) + ;; fixme groups vs srv which of? + ;; in theory the function could get multiple groups of one server + ;; but for nnvirtual server = group + (save-excursion + (let* (;; Not really a server but the matching groups for the nnvirtual group + (grouplist (mapcar #'gnus-group-short-name (gnus-search-get-active srv))) + ;; group each group as list containing each server and their groups + (group-spec (nnselect-categorize grouplist (lambda (x) (gnus-group-server x)))) + (artlist [])) + (setq artlist (vconcat artlist + (gnus-search-run-query + (list (cons 'search-query-spec query-spec) + (cons 'search-group-spec group-spec))))) + artlist))) ;; imap interface (cl-defmethod gnus-search-run-search ((engine gnus-search-imap) @@ -2153,6 +2175,7 @@ gnus-search-server-to-engine ('namazu 'gnus-search-namazu) ('find-grep 'gnus-search-find-grep) ('imap 'gnus-search-imap) + ('nnvirtual 'gnus-search-nnvirtual) (_ server)) inst (cond diff --git a/lisp/gnus/nnvirtual.el b/lisp/gnus/nnvirtual.el index 79747dca31f..edc97a8ca63 100644 --- a/lisp/gnus/nnvirtual.el +++ b/lisp/gnus/nnvirtual.el @@ -293,6 +293,13 @@ nnvirtual-close-group (nnvirtual-update-read-and-marked t t)) t) +(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)) (deffoo nnvirtual-request-newgroups (_date &optional _server) (nnheader-report 'nnvirtual "NEWGROUPS is not supported.")) -- 2.45.2 --=-=-=--