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.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 11626 invoked from network); 23 Mar 2022 00:45:32 -0000 Received: from mx1.math.uh.edu (129.7.128.32) by inbox.vuxu.org with ESMTPUTF8; 23 Mar 2022 00:45:32 -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 1nWp7x-005URx-3H for ml@inbox.vuxu.org; Tue, 22 Mar 2022 19:45:29 -0500 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 1nWp7w-006AA1-BY for ml@inbox.vuxu.org; Tue, 22 Mar 2022 19:45:28 -0500 Received: from mx2.math.uh.edu ([129.7.128.33]) by lists1.math.uh.edu with esmtp (Exim 4.94.2) (envelope-from ) id 1nWp7v-006A9v-9O for ding@lists.math.uh.edu; Tue, 22 Mar 2022 19:45:27 -0500 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 1nWp7r-00AmEL-Bb for ding@lists.math.uh.edu; Tue, 22 Mar 2022 19:45:26 -0500 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:Date:Subject:From:To: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=7oPFSehGqFl8n/yRjgjLY58Mnldt9+doAyDGemmKp8k=; b=EZzcywIkYx1ChYiAsmbgfdwlsU lWk/9WOR27Ei9qYz5hLD2e8gaD5Fg1+9djb9PbXSp82/WL4/EJuep3LsUeL6cmrEtxT2EsqsT0xoN IVO1V5UWGA/H+eyarhJv9wNzDYTeSUCxQ0K/Q3OJtuRkf+GKrG8wOew73oKjQ3HCnWPU=; Received: from ciao.gmane.io ([116.202.254.214]) by quimby.gnus.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nWp7i-0004bq-Ti for ding@gnus.org; Wed, 23 Mar 2022 01:45:19 +0100 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1nWp7h-000958-0K for ding@gnus.org; Wed, 23 Mar 2022 01:45:13 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: ding@gnus.org From: Andrew Cohen Subject: virtual nnvirtual Date: Wed, 23 Mar 2022 08:45:04 +0800 Message-ID: <87v8w51oq7.fsf@ust.hk> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cancel-Lock: sha1:Mmc98j6CIC5Gx49YG4EAbE8xp0Q= List-ID: Precedence: bulk I finally got around to fixing up an nnvirtual replacement using nnselect, and here is something for testing (mostly by Eric F., I think:)) You will need the latest version of nnselect just pushed to master (there isn't anything really specific about nnvirtual, just that the latest changes will allow NOT storing the nnvirtual group info in the newsrc which saves a lot of space). Then you should evaluate the two functions below. (All of this would be much more trivial except for the nnvirtual algorithm of interleaving the articles from the component groups---I'm not sure how great this algorithm is, but I've reproduced it. If this is all working it would be very easy to pop in an improved replacement.) This first is a convenience function for creating a group. Invoke it interactively in the group buffer and it will prompt for the new group name, and then either a list of component groups, or a (string) regexp to match for the list of component groups: #+begin_src emacs-lisp (defun gnus-group-make-nnvirtual-group (name groups) "Make an nnvirtual group using the nnselect backend. Prompts for a list or (string) regular expression of component GROUPS." (interactive (list (gnus-read-group "New Group Name: ") (read-minibuffer "Component Groups (list or regexp): ") )) (with-current-buffer gnus-group-buffer (gnus-group-make-group name (list 'nnselect "nnselect") nil (list (cons 'nnselect-specs (list (cons 'nnselect-function 'nnselect-generate-nnvirtual) (cons 'nnselect-args groups))) (cons 'nnselect-artlist nil) (cons 'nnselect-always-regenerate t))))) #+end_src This is the function that creates the artlist for the new group. #+begin_src emacs-lisp (defun nnselect-generate-nnvirtual (components) "This function generates an nnvirtual article list for GROUPS. An nnselect artlist is constructed by interleaving the articles from these component groups: the component group lists are cycled over with the most recent article popped off and pushed pushed onto the artlist; once a component group is exhausted it is skipped in subsequent cycles." (let ((groups nil)) ;; Get the list of component groups. (if (listp components) (setq groups components) (dolist (group (cdr gnus-group-list)) (when (string-match components group) (setq groups (cons group groups)))) (setq groups (delete-dups groups))) ;; Prepare the group data. (let ((gdata nil) (count 0)) (dolist (group groups) (pcase-let ((`(,min . ,max) (gnus-active group))) (cl-incf max) (cl-incf count (- max min)) (push (list max group min) gdata))) (setq gdata (sort gdata 'car-less-than-car)) ;; Make and fill the vector. Think of the component article ;; lists as columns in a matrix. We map over the rows and ;; remove a column once it is empty. (let ((artlist (make-vector count nil))) (while gdata (pcase-let ((`(,max ,group ,min) (pop gdata))) (while (< min max) (aset artlist (cl-decf count) (vector group (cl-decf max) 1)) (mapc (lambda (data) (aset artlist (cl-decf count) (vector (cadr data) (cl-decf (car data)) 1))) gdata)))) artlist)))) #+end_src -- Andrew Cohen