aboutsummaryrefslogtreecommitdiffstats
path: root/doc/misc
diff options
context:
space:
mode:
authorAndrew G Cohen2020-09-05 08:46:43 +0800
committerAndrew G Cohen2020-09-05 08:46:43 +0800
commitecfc13e41627511769e00a2d0a7568d5bdbe8a0d (patch)
tree0594654501fdfb3ded9233a01fecd96ef9924e5a /doc/misc
parentf450798cb0b9bedfa73efff14605a04eec4f1d9e (diff)
downloademacs-ecfc13e41627511769e00a2d0a7568d5bdbe8a0d.tar.gz
emacs-ecfc13e41627511769e00a2d0a7568d5bdbe8a0d.zip
Introduce nnselect backend for gnus
This new backend allows gnus to handle arbitrary sets of messages spanning multiple groups, even when these groups are from different backends and different servers. All gnus glue is removed from nnir (leaving only the backend search functions) and gnus search-related processing is done through nnselect. In appropriate places 'nnir' has been replaced by 'nnselect' or 'search'. * etc/NEWS: Document the change. * doc/misc/gnus.texi: New documentation for nnselect and update searching and thread-referral sections. * lisp/gnus/nnselect.el: New file. * lisp/gnus/nnir.el: Remove all gnus glue, leaving only searching capability. Improve documentation strings. * lisp/gnus/gnus-group.el (gnus-group-read-ephemeral-search-group, gnus-group-make-search-group): New functions. * lisp/gnus/gnus-msg.el (gnus-setup-message, gnus-group-news, gnus-summary-news-other-window): Update to work for nnselect. Fix gnus-newsgroup-name wrangling. *lisp/gnus/gnus-registry.el (gnus-registry-action,gnus-registry-ignore-group-p): Make work from nnselect. * lisp/gnus/nnheader.el (nnheader-parse-head, nnheader-parse-nov): Rework and consolidate header parsing. * lisp/gnus/gnus-agent.el (gnus-agent-regenerate-group): * lisp/gnus/gnus-cache.el (gnus-possibly-enter-article): * lisp/gnus/gnus-cloud.el (gnus-cloud-available-chunks): * lisp/gnus/gnus-msg.el (gnus-inews-yank-articles): * lisp/gnus/gnus-sum. (gnus-get-newsgroup-headers): * lisp/gnus/nndiary.el (nndiary-parse-head): * lisp/gnus/nnfolder.el (nnfolder-parse-head): * lisp/gnus/nnmaildir.el (nnmaildir--update-nov): * lisp/gnus/nnml.el (nnml-parse-head): * lisp/gnus/nnspool.el (nnspool-insert-nov-head): Use new header parsing. * lisp/gnus/gnus-start.el (gnus-read-active-for-groups): Rescan on activation by default. * lisp/gnus/gnus-sum.el (gnus-summary-line-format-alist): New specs for virtual groups. (gnus-article-sort-by-rsv, gnus-thread-sort-by-rsv): New functions to allow sorting by search RSV.
Diffstat (limited to 'doc/misc')
-rw-r--r--doc/misc/gnus.texi259
1 files changed, 186 insertions, 73 deletions
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 0bdc2fa297d..593f113ac14 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -641,7 +641,7 @@ Select Methods
641* Getting Mail:: Reading your personal mail with Gnus. 641* Getting Mail:: Reading your personal mail with Gnus.
642* Browsing the Web:: Getting messages from a plethora of Web sources. 642* Browsing the Web:: Getting messages from a plethora of Web sources.
643* Other Sources:: Reading directories, files. 643* Other Sources:: Reading directories, files.
644* Combined Groups:: Combining groups into one group. 644* Virtual Groups:: Combining articles from multiple sources.
645* Email Based Diary:: Using mails to manage diary events in Gnus. 645* Email Based Diary:: Using mails to manage diary events in Gnus.
646* Gnus Unplugged:: Reading news and mail offline. 646* Gnus Unplugged:: Reading news and mail offline.
647 647
@@ -716,9 +716,10 @@ Document Groups
716 716
717* Document Server Internals:: How to add your own document types. 717* Document Server Internals:: How to add your own document types.
718 718
719Combined Groups 719Virtual Groups
720 720
721* Virtual Groups:: Combining articles from many groups. 721* Selection Groups:: Articles selected from many places.
722* Combined Groups:: Combining multiple groups.
722 723
723Email Based Diary 724Email Based Diary
724 725
@@ -10407,12 +10408,20 @@ article (@code{gnus-summary-refer-references}).
10407@findex gnus-summary-refer-thread 10408@findex gnus-summary-refer-thread
10408@kindex A T @r{(Summary)} 10409@kindex A T @r{(Summary)}
10409Display the full thread where the current article appears 10410Display the full thread where the current article appears
10410(@code{gnus-summary-refer-thread}). This command has to fetch all the 10411(@code{gnus-summary-refer-thread}). By default this command looks for
10411headers in the current group to work, so it usually takes a while. If 10412articles only in the current group. Some backends (currently only
10412you do it often, you may consider setting @code{gnus-fetch-old-headers} 10413'nnimap) know how to find articles in the thread directly. In other
10413to @code{invisible} (@pxref{Filling In Threads}). This won't have any 10414cases each header in the current group must be fetched and examined,
10414visible effects normally, but it'll make this command work a whole lot 10415so it usually takes a while. If you do it often, you may consider
10415faster. Of course, it'll make group entry somewhat slow. 10416setting @code{gnus-fetch-old-headers} to @code{invisible}
10417(@pxref{Filling In Threads}). This won't have any visible effects
10418normally, but it'll make this command work a whole lot faster. Of
10419course, it'll make group entry somewhat slow.
10420
10421@vindex gnus-refer-thread-use-search
10422If @code{gnus-refer-thread-use-search} is non-nil then those backends
10423that know how to find threads directly will search not just in the
10424current group but all groups on the same server.
10416 10425
10417@vindex gnus-refer-thread-limit 10426@vindex gnus-refer-thread-limit
10418The @code{gnus-refer-thread-limit} variable says how many old (i.e., 10427The @code{gnus-refer-thread-limit} variable says how many old (i.e.,
@@ -10421,6 +10430,15 @@ fetch when doing this command. The default is 200. If @code{t}, all
10421the available headers will be fetched. This variable can be overridden 10430the available headers will be fetched. This variable can be overridden
10422by giving the @kbd{A T} command a numerical prefix. 10431by giving the @kbd{A T} command a numerical prefix.
10423 10432
10433@vindex gnus-refer-thread-limit-to-thread
10434In most cases @code{gnus-refer-thread} adds any articles it finds to
10435the current summary buffer. (When @code{gnus-refer-thread-use-search}
10436is true and the initial referral starts from a summary buffer for a
10437non-virtual group this may not be possible. In this case a new summary
10438buffer is created holding a virtual group with the result of the thread
10439search). If @code{gnus-refer-thread-limit-to-thread} is non-nil then
10440the summary buffer will be limited to articles in the thread.
10441
10424@item M-^ (Summary) 10442@item M-^ (Summary)
10425@findex gnus-summary-refer-article 10443@findex gnus-summary-refer-article
10426@kindex M-^ @r{(Summary)} 10444@kindex M-^ @r{(Summary)}
@@ -13262,7 +13280,7 @@ The different methods all have their peculiarities, of course.
13262* Getting Mail:: Reading your personal mail with Gnus. 13280* Getting Mail:: Reading your personal mail with Gnus.
13263* Browsing the Web:: Getting messages from a plethora of Web sources. 13281* Browsing the Web:: Getting messages from a plethora of Web sources.
13264* Other Sources:: Reading directories, files. 13282* Other Sources:: Reading directories, files.
13265* Combined Groups:: Combining groups into one group. 13283* Virtual Groups:: Combining articles and groups together.
13266* Email Based Diary:: Using mails to manage diary events in Gnus. 13284* Email Based Diary:: Using mails to manage diary events in Gnus.
13267* Gnus Unplugged:: Reading news and mail offline. 13285* Gnus Unplugged:: Reading news and mail offline.
13268@end menu 13286@end menu
@@ -17834,19 +17852,133 @@ methods, but want to only use secondary ones:
17834@end lisp 17852@end lisp
17835 17853
17836 17854
17837@node Combined Groups 17855@node Virtual Groups
17838@section Combined Groups 17856@section Virtual Groups
17839 17857
17840Gnus allows combining a mixture of all the other group types into bigger 17858Gnus allows combining articles from many sources, and combinations of
17841groups. 17859whole groups together into virtual groups.
17842 17860
17843@menu 17861@menu
17844* Virtual Groups:: Combining articles from many groups. 17862* Selection Groups:: Combining articles from many groups.
17863* Combined Groups:: Combining multiple groups.
17845@end menu 17864@end menu
17846 17865
17847 17866
17848@node Virtual Groups 17867@node Selection Groups
17849@subsection Virtual Groups 17868@subsection Select Groups
17869@cindex nnselect
17870@cindex select groups
17871@cindex selecting articles
17872
17873
17874Gnus provides the @dfn{nnselect} method for creating virtual groups
17875composed of collections of messages, even when these messages come
17876from groups that span multiple servers and backends. For the most part
17877these virtual groups behave like any other group: messages may be
17878threaded, marked, moved, deleted, copied, etc.; groups may be
17879ephemeral or persistent; groups may be created via
17880@code{gnus-group-make-group} or browsed as foreign via
17881@code{gnus-group-browse-foreign-server}.
17882
17883The key to using an nnselect group is specifying the messages to
17884include. Each nnselect group has a group parameter
17885@code{nnselect-specs} which is an alist with two elements: a function
17886@code{nnselect-function}; and arguments @code{nnselect-args} to be
17887passed to the function, if any.
17888
17889The function @code{nnselect-function} must return a vector. Each
17890element of this vector is in turn a 3-element vector corresponding to
17891one message. The 3 elements are: the fully-qualified group name; the
17892message number; and a "score" that can be used for additional
17893sorting. The values for the score are arbitrary, and are not used
17894directly by the nnselect method---they may, for example, all be set to
17895100.
17896
17897Here is an example:
17898
17899@lisp
17900 (nnselect-specs
17901 (nnselect-function . identity)
17902 (nnselect-args .
17903 [["nnimap+work:mail" 595 100]
17904 ["nnimap+home:sent" 223 100]
17905 ["nntp+news.gmane.org:gmane.emacs.gnus.general" 23666 100]]))
17906@end lisp
17907
17908The function is the identity and the argument is just the list of
17909messages to include in the virtual group.
17910
17911Or we may wish to create a group from the results of a search query:
17912
17913@lisp
17914 (nnselect-specs
17915 (nnselect-function . nnir-run-query)
17916 (nnselect-args
17917 (nnir-query-spec
17918 (query . "FLAGGED")
17919 (criteria . ""))
17920 (nnir-group-spec
17921 ("nnimap:home")
17922 ("nnimap:work"))))
17923@end lisp
17924
17925This creates a group including all flagged messages from all groups on
17926two imap servers, "home" and "work".
17927
17928And one last example. Here is a function that runs a search query to
17929find all message that have been received recently from certain groups:
17930
17931@lisp
17932(defun my-recent-email (args)
17933 (let ((query-spec
17934 (list
17935 (cons 'query
17936 (format-time-string "SENTSINCE %d-%b-%Y"
17937 (time-subtract (current-time)
17938 (days-to-time (car args)))))
17939 (cons 'criteria "")))
17940 (group-spec (cadr args)))
17941 (nnir-run-query (cons 'nnir-specs
17942 (list (cons 'nnir-query-spec query-spec)
17943 (cons 'nnir-group-spec group-spec))))))
17944@end lisp
17945
17946Then an nnselect-specs
17947
17948@lisp
17949 (nnselect-specs
17950 (nnselect-function . my-recent-email)
17951 (nnselect-args . (7 (("nnimap:home") ("nnimap:work")))))
17952@end lisp
17953
17954will provide a group composed of all messages on the home and work
17955servers received in the last 7 days.
17956
17957Refreshing the selection of an nnselect group by running the
17958@code{nnselect-function} may take a long time to
17959complete. Consequently nnselect groups are not refreshed by default
17960when @code{gnus-group-get-new-news} is invoked. In those cases where
17961running the function is not too time-consuming, a non-nil group
17962parameter of @code{nnselect-rescan} will allow automatic refreshing. A
17963refresh can always be invoked manually through
17964@code{gnus-group-get-new-news-this-group}.
17965
17966The nnir interface (@pxref{nnir}) includes engines for searching a
17967variety of backends. While the details of each search engine vary, the
17968result of an nnir search is always a vector of the sort used by the
17969nnselect method, and the results of nnir queries are usually viewed
17970using an nnselect group. Indeed the standard search function
17971@code{gnus-group-read-ephemeral-search-group} just creates an
17972ephemeral nnselect group with the appropriate nnir query as the
17973@code{nnselect-specs}. nnir originally included both the search
17974engines and the glue to connect search results to gnus. Over time this
17975glue evolved into the nnselect method. The two had
17976a mostly amicable parting so that nnselect could pursue its dream of
17977becoming a fully functioning backend, but occasional conflicts may
17978still linger.
17979
17980@node Combined Groups
17981@subsection Combined Groups
17850@cindex nnvirtual 17982@cindex nnvirtual
17851@cindex virtual groups 17983@cindex virtual groups
17852@cindex merging groups 17984@cindex merging groups
@@ -21238,14 +21370,26 @@ four days, Gnus will decay the scores four times, for instance.
21238@chapter Searching 21370@chapter Searching
21239@cindex searching 21371@cindex searching
21240 21372
21241FIXME: Add a brief overview of Gnus search capabilities. A brief 21373FIXME: A brief comparison of nnir, nnmairix, contrib/gnus-namazu would
21242comparison of nnir, nnmairix, contrib/gnus-namazu would be nice 21374be nice.
21243as well. 21375
21244 21376Gnus has various ways of finding articles that match certain criteria
21245This chapter describes tools for searching groups and servers for 21377(from a particular author, on a certain subject, etc). The simplest
21246articles matching a query and then retrieving those articles. Gnus 21378method is to enter a group and then either "limit" the summary buffer
21247provides a simpler mechanism for searching through articles in a summary buffer 21379to the desired articles using the limiting commands (@xref{Limiting}),
21248to find those matching a pattern. @xref{Searching for Articles}. 21380or searching through messages in the summary buffer (@xref{Searching
21381for Articles}).
21382
21383Limiting commands and summary buffer searching work on subsets of the
21384articles already fetched from the servers, and these commands won’t
21385query the server for additional articles. While simple, these methods
21386are therefore inadequate if the desired articles span multiple groups,
21387or if the group is so large that fetching all articles is
21388impractical. Many backends (such as imap, notmuch, namazu, etc.)
21389provide their own facilities to search for articles directly on the
21390server and gnus can take advantage of these methods. This chapter
21391describes tools for searching groups and servers for articles matching
21392a query.
21249 21393
21250@menu 21394@menu
21251* nnir:: Searching with various engines. 21395* nnir:: Searching with various engines.
@@ -21275,7 +21419,7 @@ through mail and news repositories. Different backends (like
21275interface. 21419interface.
21276 21420
21277The @code{nnimap} search engine should work with no configuration. 21421The @code{nnimap} search engine should work with no configuration.
21278Other engines require a local index that needs to be created and 21422Other engines may require a local index that needs to be created and
21279maintained outside of Gnus. 21423maintained outside of Gnus.
21280 21424
21281 21425
@@ -21283,23 +21427,19 @@ maintained outside of Gnus.
21283@subsection Basic Usage 21427@subsection Basic Usage
21284 21428
21285In the group buffer typing @kbd{G G} will search the group on the 21429In the group buffer typing @kbd{G G} will search the group on the
21286current line by calling @code{gnus-group-make-nnir-group}. This prompts 21430current line by calling @code{gnus-group-make-search-group}. This prompts
21287for a query string, creates an ephemeral @code{nnir} group containing 21431for a query string, creates an ephemeral @code{nnselect} group containing
21288the articles that match this query, and takes you to a summary buffer 21432the articles that match this query, and takes you to a summary buffer
21289showing these articles. Articles may then be read, moved and deleted 21433showing these articles. Articles may then be read, moved and deleted
21290using the usual commands. 21434using the usual commands.
21291 21435
21292The @code{nnir} group made in this way is an @code{ephemeral} group, 21436The @code{nnselect} group made in this way is an @code{ephemeral}
21293and some changes are not permanent: aside from reading, moving, and 21437group, and will disappear upon exit from the group. However changes
21294deleting, you can't act on the original article. But there is an 21438made in the group are permanently reflected in the real groups from
21295alternative: you can @emph{warp} (i.e., jump) to the original group 21439which the articles are drawn. It is occasionally convenient to view
21296for the article on the current line with @kbd{A W}, aka 21440articles found through searching in their original group. You can
21297@code{gnus-warp-to-article}. Even better, the function 21441@emph{warp} (i.e., jump) to the original group for the article on the
21298@code{gnus-summary-refer-thread}, bound by default in summary buffers 21442current line with @kbd{A W}, aka @code{gnus-warp-to-article}.
21299to @kbd{A T}, will first warp to the original group before it works
21300its magic and includes all the articles in the thread. From here you
21301can read, move and delete articles, but also copy them, alter article
21302marks, whatever. Go nuts.
21303 21443
21304You say you want to search more than just the group on the current line? 21444You say you want to search more than just the group on the current line?
21305No problem: just process-mark the groups you want to search. You want 21445No problem: just process-mark the groups you want to search. You want
@@ -21307,14 +21447,14 @@ even more? Calling for an nnir search with the cursor on a topic heading
21307will search all the groups under that heading. 21447will search all the groups under that heading.
21308 21448
21309Still not enough? OK, in the server buffer 21449Still not enough? OK, in the server buffer
21310@code{gnus-group-make-nnir-group} (now bound to @kbd{G}) will search all 21450@code{gnus-group-make-search-group} (now bound to @kbd{G}) will search
21311groups from the server on the current line. Too much? Want to ignore 21451all groups from the server on the current line. Too much? Want to
21312certain groups when searching, like spam groups? Just customize 21452ignore certain groups when searching, like spam groups? Just
21313@code{nnir-ignored-newsgroups}. 21453customize @code{nnir-ignored-newsgroups}.
21314 21454
21315One more thing: individual search engines may have special search 21455One more thing: individual search engines may have special search
21316features. You can access these special features by giving a prefix-arg 21456features. You can access these special features by giving a prefix-arg
21317to @code{gnus-group-make-nnir-group}. If you are searching multiple 21457to @code{gnus-group-make-search-group}. If you are searching multiple
21318groups with different search engines you will be prompted for the 21458groups with different search engines you will be prompted for the
21319special search features for each engine separately. 21459special search features for each engine separately.
21320 21460
@@ -21371,8 +21511,7 @@ variable is set to use the @code{imap} engine for all servers using the
21371your servers with an @code{nnimap} backend you could change this to 21511your servers with an @code{nnimap} backend you could change this to
21372 21512
21373@lisp 21513@lisp
21374'((nnimap . namazu) 21514'((nnimap . namazu))
21375 (nntp . gmane))
21376@end lisp 21515@end lisp
21377 21516
21378@node The imap Engine 21517@node The imap Engine
@@ -21575,7 +21714,7 @@ This engine is obsolete.
21575 21714
21576@item nnir-method-default-engines 21715@item nnir-method-default-engines
21577Alist of pairs of server backends and search engines. The default 21716Alist of pairs of server backends and search engines. The default
21578associations are 21717association is
21579@example 21718@example
21580(nnimap . imap) 21719(nnimap . imap)
21581@end example 21720@end example
@@ -21584,32 +21723,6 @@ associations are
21584A regexp to match newsgroups in the active file that should be skipped 21723A regexp to match newsgroups in the active file that should be skipped
21585when searching all groups on a server. 21724when searching all groups on a server.
21586 21725
21587@item nnir-summary-line-format
21588The format specification to be used for lines in an nnir summary buffer.
21589All the items from @code{gnus-summary-line-format} are available, along with
21590three items unique to nnir summary buffers:
21591
21592@example
21593%Z Search retrieval score value (integer)
21594%G Article original full group name (string)
21595%g Article original short group name (string)
21596@end example
21597
21598If @code{nil} (the default) this will use @code{gnus-summary-line-format}.
21599
21600@item nnir-retrieve-headers-override-function
21601If non-@code{nil}, a function that retrieves article headers rather than using
21602the gnus built-in function. This function takes an article list and
21603group as arguments and populates the @code{nntp-server-buffer} with the
21604retrieved headers. It should then return either 'nov or 'headers
21605indicating the retrieved header format. Failure to retrieve headers
21606should return @code{nil}.
21607
21608If this variable is @code{nil}, or if the provided function returns
21609@code{nil} for a search result, @code{gnus-retrieve-headers} will be
21610called instead."
21611
21612
21613@end table 21726@end table
21614 21727
21615 21728