Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* feature/gnus-select2
@ 2019-10-16 11:54 Andrew Cohen
  2019-10-16 15:52 ` feature/gnus-select2 Eric Abrahamsen
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cohen @ 2019-10-16 11:54 UTC (permalink / raw)
  To: info-gnus-english


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. 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 produce 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.


=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:

 (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 including 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=.


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: feature/gnus-select2
  2019-10-16 11:54 feature/gnus-select2 Andrew Cohen
@ 2019-10-16 15:52 ` Eric Abrahamsen
  2019-10-16 18:53   ` feature/gnus-select2 Lars-Johan Liman
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Abrahamsen @ 2019-10-16 15:52 UTC (permalink / raw)
  To: info-gnus-english

Andrew Cohen <cohen@bu.edu> writes:

> 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. Please check it out and if no obvious
> bugs appear I will figure out how to push this into master.

Very excited to see this getting closer! I would also repost to
emacs.devel, as they will be able to advise on merging. Plus I'm not
sure that many people read this group, and an addition of this size
should probably go through them.


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: feature/gnus-select2
  2019-10-16 15:52 ` feature/gnus-select2 Eric Abrahamsen
@ 2019-10-16 18:53   ` Lars-Johan Liman
  0 siblings, 0 replies; 3+ messages in thread
From: Lars-Johan Liman @ 2019-10-16 18:53 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: info-gnus-english

Andrew Cohen <cohen@bu.edu> writes:
>> 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. Please check it out and if no obvious
>> bugs appear I will figure out how to push this into master.

eric@ericabrahamsen.net:
> Very excited to see this getting closer!

+1 ... or, make that +2! :-)

> I would also repost to emacs.devel, as they will be able to advise on
> merging. Plus I'm not sure that many people read this group,

(I do! ;-) )

> and an addition of this size should probably go through them.

				Cheers,
				  /Liman

_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-16 18:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16 11:54 feature/gnus-select2 Andrew Cohen
2019-10-16 15:52 ` feature/gnus-select2 Eric Abrahamsen
2019-10-16 18:53   ` feature/gnus-select2 Lars-Johan Liman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).