From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#37871: 27.0.50; Merge feature/gnus-select2 Date: Tue, 22 Oct 2019 09:14:43 -0700 Message-ID: <87blu8lpu4.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="181184"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Andrew Cohen , Lars Ingebrigtsen To: 37871@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 22 18:15:15 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iMwoV-000l0X-1T for geb-bug-gnu-emacs@m.gmane.org; Tue, 22 Oct 2019 18:15:15 +0200 Original-Received: from localhost ([::1]:35196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMwoT-0002dp-Sk for geb-bug-gnu-emacs@m.gmane.org; Tue, 22 Oct 2019 12:15:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36668) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMwoK-0002bc-EA for bug-gnu-emacs@gnu.org; Tue, 22 Oct 2019 12:15:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMwoI-0004YG-T4 for bug-gnu-emacs@gnu.org; Tue, 22 Oct 2019 12:15:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51550) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMwoI-0004YA-PP for bug-gnu-emacs@gnu.org; Tue, 22 Oct 2019 12:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iMwoI-0007VQ-L5 for bug-gnu-emacs@gnu.org; Tue, 22 Oct 2019 12:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Oct 2019 16:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37871 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.157176089828807 (code B ref -1); Tue, 22 Oct 2019 16:15:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Oct 2019 16:14:58 +0000 Original-Received: from localhost ([127.0.0.1]:60369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMwoE-0007UZ-9T for submit@debbugs.gnu.org; Tue, 22 Oct 2019 12:14:58 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:58909) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMwoC-0007UR-T4 for submit@debbugs.gnu.org; Tue, 22 Oct 2019 12:14:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36621) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMwoB-0002aH-Ae for bug-gnu-emacs@gnu.org; Tue, 22 Oct 2019 12:14:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMwo9-0004Uu-LX for bug-gnu-emacs@gnu.org; Tue, 22 Oct 2019 12:14:55 -0400 Original-Received: from ericabrahamsen.net ([52.70.2.18]:43604 helo=mail.ericabrahamsen.net) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iMwo9-0004Sp-HL for bug-gnu-emacs@gnu.org; Tue, 22 Oct 2019 12:14:53 -0400 Original-Received: from localhost (c-73-254-86-141.hsd1.wa.comcast.net [73.254.86.141]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 39F23FA0E3; Tue, 22 Oct 2019 16:14:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:169992 Archived-At: Hi all, Andy Cohen's nnselect Gnus backend looks ready to merge -- he wrote to emacs.devel but it occurs to me it might be better to start here. His original message is here, and I've pasted the full text below the link: https://lists.gnu.org/archive/html/emacs-devel/2019-10/msg00689.html ------ After many months I have updated the gnus-select2 feature branch. This incorporates a number of bug fixes as well as updating to the latest master. I have been using this version (or something close to it) for nearly a year with no problems. For those who use gnus please check it out and if no obvious bugs appear I will figure out how to push this into master. This branch introduces a new "virtual" backend, nnselect, that allows an arbitrary list of messages to be treated as a normal gnus group. The messages may come from multiple servers and multiple backends. The resulting group behaves in (almost) all respects like any real group: messages may be threaded, marked, moved, deleted, copied, etc. nnselect groups may be ephemeral or persistent. An obvious use case for nnselect is to create a functional group out of the messages produced by some kind of search. In this feature branch searching (performed by nnir) simply returns a list of articles that is passed to nnselect, which handles the group creation and message manipulation. (This should be transparent to the user---that is, searching should appear to function as before, except that the group created from the search has more functionality). Below is a first pass at some documentation that hasn't yet been pushed into the gnus manual on the branch. =nnselect= is a select method for virtual groups composed of messages from other groups that may span multiple servers and backends. For the most part these groups behave like any other group: messages may be threaded, marked, moved, deleted, copied, etc.; groups may be ephemeral or persistent; groups may be created via gnus-group-make-group or browsed as foreign via gnus-group-browse-foreign-server. The key to using an nnselect group is specifying the messages to include. Each nnselect group has a group parameter =nnselect-specs= which is an alist with two elements: a function =nnselect-function=; and arguments =nnselect-args= to be passed to the function, if any. The function =nnselect-function= must return a vector. Each element of this vector is in turn a 3-element vector corresponding to one message. The 3 elements are: the fully-qualified group name; the message number; and a "score" that can be used for additional sorting. The values for the score are arbitrary, and are not used directly by the nnselect method---they may, for example, all be set to 100. As an example we might have a group whose nnselect-specs are (nnselect-specs (nnselect-function . identity) (nnselect-args . [["nnimap+work:mail" 595 100] ["nnimap+home:sent" 223 100] ["nntp+news.gmane.org:gmane.emacs.gnus.general" 23666 100]))) Here the function is the identity and the argument is just a list of messages. Or the function might be a search query (using nnir): (nnselect-specs (nnselect-function . nnir-run-query) (nnselect-args (nnir-query-spec (query . "FLAGGED") (criteria . "")) (nnir-group-spec ("nnimap:home") ("nnimap:work")))) This creates a group composed of all flagged messages on two imap servers, "home" and "work". And one last example. Here is a function that runs a search query to find all message that have been received over the past =days= (defun my-recent-email (days) (let ((query-spec (list (cons 'query (format-time-string "SENTSINCE %d-%b-%Y" (time-subtract (current-time) (days-to-time days)))) (cons 'criteria ""))) (group-spec (list (list "nnimap:home") (list "nnimap:work")))) (nnir-run-query (cons 'nnir-specs (list (cons 'nnir-query-spec query-spec) (cons 'nnir-group-spec group-spec)))))) Then an nnselect-specs (nnselect-specs (nnselect-function . my-recent-email) (nnselect-args . 7)) will provide a group composed of all messages on the home and work servers received in the last 7 days. ** scanning Refreshing the selection of an nnselect group by running the nnselect-function may take a long time to complete. Consequently nnselect groups are not refreshed by default when =gnus-group-get-new-news= is invoked. In those cases where running the function is not too time-consuming, a group parameter of nnselect-rescan can be set to allow automatic refreshing. A refresh can always be invoked manually through =gnus-group-get-new-news-this-group=.