From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 7489 invoked from network); 3 Mar 2022 18:17:31 -0000 Received: from mx1.math.uh.edu (129.7.128.32) by inbox.vuxu.org with ESMTPUTF8; 3 Mar 2022 18:17:31 -0000 Received: from lists1.math.uh.edu ([129.7.128.208]) by mx1.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nPq13-009ezT-Go for ml@inbox.vuxu.org; Thu, 03 Mar 2022 12:17:29 -0600 Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.94.2) (envelope-from ) id 1nPq12-00562L-Se for ml@inbox.vuxu.org; Thu, 03 Mar 2022 12:17:28 -0600 Received: from mx2.math.uh.edu ([129.7.128.33]) by lists1.math.uh.edu with esmtp (Exim 4.94.2) (envelope-from ) id 1nPolK-0055vw-J4 for ding@lists.math.uh.edu; Thu, 03 Mar 2022 10:57:10 -0600 Received: from quimby.gnus.org ([95.216.78.240]) by mx2.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nPolG-00GFz9-MS for ding@lists.math.uh.edu; Thu, 03 Mar 2022 10:57:10 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=1eUAywoYxBdhb7lOsxcuTdj/zb/sxajWHihgNGTtUqA=; b=r6fbtxHBqyxNKQFOE+zosbobeX ES55DRHpZ7uyFia2UUV340n8lMemt3jHshL0roRpoqDHvlhiSluasg3oD/zV76iDF7hFzlB1zoueY 2SRRHZLFsXqOsFphEeQGt7mWi4bLxlXJinSG6IVuEam+UYIYNRhOFYfU5VoD9rFNROiI=; Received: from latitanza.investici.org ([2001:888:2000:56::19]) by quimby.gnus.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nPol8-0001yU-Hm for ding@gnus.org; Thu, 03 Mar 2022 17:57:00 +0100 Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id 4K8cbF152kzGp4j for ; Thu, 3 Mar 2022 16:56:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=onenetbeyond.org; s=stigmate; t=1646326617; bh=1eUAywoYxBdhb7lOsxcuTdj/zb/sxajWHihgNGTtUqA=; h=From:To:Subject:References:Date:In-Reply-To:From; b=G7C6FWARSvXF5qnL0HJlM9qdIhRg7b8qqQN2d5zyy4T9CrFHhvnJYuOLexSX3VJEI u6NeaEOQEh3H9Aqus4GrUWgSQheNNgGrYQDRohQ8ZEOZkdAJ15SRZ9dIna4jvSFQS+ J7+/uLfKoTNNusBiSjA5Ax0GiSCd2o3Lc5EYrqY4= Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234]) (Authenticated sender: dal-blazej@onenetbeyond.org) by localhost (Postfix) with ESMTPSA id 4K8cbC5jL3zGp4Z for ; Thu, 3 Mar 2022 16:56:55 +0000 (UTC) From: dal-blazej@onenetbeyond.org To: ding@gnus.org Subject: Re: search engine for virtual group? References: <878ruuifvq.fsf@ericabrahamsen.net> <87tudicjnh.fsf@ucl.ac.uk> Date: Thu, 03 Mar 2022 17:56:49 +0100 In-Reply-To: <87tudicjnh.fsf@ucl.ac.uk> (Eric S. Fraga's message of "Tue, 01 Feb 2022 22:21:54 +0000") Message-ID: <87sfrzvusu.fsf@onenetbeyond.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain List-ID: Precedence: bulk Hi, Here are some of my observations about nnselect groups : *** nnselect groups :PROPERTIES: :header-args: :noweb-ref gnus-nnselect-groups :tangle no :END: The nnselect method replaces the obsolete nnir method and most usage of virtual groups. Basically it lets you makes searches out of your servers, eventually making it permanent as a new group. It is designed to be build interactively (and well, it's /kinda/ easier). Can we wrap it non-interactively so it becomes declarative ? Yup. #+begin_src emacs-lisp (with-eval-after-load 'gnus (defun dal-gnus-group-make-group-batch (name meth address args) "Same as `gnus-group-make-group', but can be run non-interactively." (unless (gnus-get-info (gnus-group-prefixed-name name meth)) (cl-letf (((symbol-function 'gnus-group-insert-group-line-info) #'ignore) ((symbol-function 'gnus-group-position-point) #'ignore)) (save-excursion (gnus-group-make-group name meth address args)))))) (add-hook 'gnus-topic-mode-hook (lambda () (dal-gnus-group-make-group-batch "recent" '(nnselect "nnselect") nil '((nnselect-specs (nnselect-function . gnus-search-run-query) (nnselect-args (search-query-spec (query . "sentsince:7d")) (search-group-spec ("nnimap:Dal")))) (nnselect-rescan . t))))) #+end_src The group creation does not allow to specify arbitrary group parameters, let's correct that. #+begin_src emacs-lisp (with-eval-after-load 'nnoo ;; First the creation of the group does not allow to set parameters. (defun nnselect-request-create-group-a (group &optional _server args) (message "Creating nnselect group %s" group) (let* ((group (gnus-group-prefixed-name group '(nnselect "nnselect"))) (specs (assq 'nnselect-specs args)) (function-spec (or (alist-get 'nnselect-function specs) (intern (completing-read "Function: " obarray #'functionp)))) (args-spec (or (alist-get 'nnselect-args specs) (read-from-minibuffer "Args: " nil nil t nil "nil"))) (nnselect-specs (list (cons 'nnselect-function function-spec) (cons 'nnselect-args args-spec)))) (gnus-group-set-parameter group 'nnselect-specs nnselect-specs) (gnus-group-set-parameter group 'nnselect-artlist (nnselect-compress-artlist (or (alist-get 'nnselect-artlist args) (nnselect-run nnselect-specs)))) (setq args (assq-delete-all 'nnselect-specs args)) ;; patch (dolist (param args) (gnus-group-set-parameter group (car param) (cdr param))) (nnselect-request-update-info group (gnus-get-info group))) t) (advice-add 'nnselect-request-create-group :override #'nnselect-request-create-group-a) #+end_src Rescan the group regularly. but that doesn't work ?! Wth ? #+begin_src emacs-lisp (add-to-list 'gnus-parameters '("nnselect:recent" (nnselect-rescan . t))) #+end_src It doesn't work because of a confusion between ~gnus-group-get-parameter~ and ~gnus-group-find-parameter~. #+begin_src emacs-lisp (defun nnselect-request-scan-a (group _method) (when (and group (gnus-group-find-parameter (nnselect-add-prefix group) ; patch 'nnselect-rescan t)) (nnselect-request-group-scan group))) (advice-add 'nnselect-request-scan :override #'nnselect-request-scan-a)) #+end_src