1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-17 03:10:58 -08:00

Add Gnus function to make a persistent group from a search result

* lisp/gnus/gnus-sum.el (gnus-summary-make-group-from-search): New
command (bound to C-c C-p in summary buffers).
* doc/misc/gnus.texi (What is nnir?): Document it. Correct previous
errors.
* etc/NEWS (Gnus): Mention it.
This commit is contained in:
Andrew G Cohen 2020-09-09 09:58:39 +08:00
parent 45c0bbb921
commit c50643cebd
3 changed files with 57 additions and 23 deletions

View file

@ -21452,19 +21452,29 @@ maintained outside of Gnus.
@subsection Basic Usage @subsection Basic Usage
In the group buffer typing @kbd{G G} will search the group on the In the group buffer typing @kbd{G G} will search the group on the
current line by calling @code{gnus-group-make-search-group}. This prompts current line by calling @code{gnus-group-read-ephemeral-search-group}.
for a query string, creates an ephemeral @code{nnselect} group containing This prompts for a query string, creates an ephemeral @code{nnselect}
the articles that match this query, and takes you to a summary buffer group containing the articles that match this query, and takes you to
showing these articles. Articles may then be read, moved and deleted a summary buffer showing these articles. Articles may then be read,
using the usual commands. moved and deleted using the usual commands.
The @code{nnselect} group made in this way is an @code{ephemeral} The @code{nnselect} group made in this way is @code{ephemeral}: it
group, and will disappear upon exit from the group. However changes will disappear upon exit from the group. However changes made in the
made in the group are permanently reflected in the real groups from group are permanently reflected in the real groups from which the
which the articles are drawn. It is occasionally convenient to view articles are drawn. If you want to create a @emph{persistent} group
articles found through searching in their original group. You can that sticks around after exit from the summary buffer, you can call
@emph{warp} (i.e., jump) to the original group for the article on the @code{gnus-group-make-search-group} (bound to @kbd{G g}).
current line with @kbd{A W}, aka @code{gnus-warp-to-article}.
So you just performed a search whose results are so fabulous you
wished you had done a persistent search rather than an ephemeral one?
No problem; you can create such a group by calling
@code{gnus-summary-make-group-from-search} (bound to @kbd{C-c C-p})
from the ephemeral summary buffer.
It is occasionally convenient to view articles found through searching
in their original group. You can @emph{warp} (i.e., jump) to the
original group for the article on the current line with @kbd{A W}, aka
@code{gnus-warp-to-article}.
You say you want to search more than just the group on the current line? You say you want to search more than just the group on the current line?
No problem: just process-mark the groups you want to search. You want No problem: just process-mark the groups you want to search. You want
@ -21472,16 +21482,17 @@ even more? Calling for an nnir search with the cursor on a topic heading
will search all the groups under that heading. will search all the groups under that heading.
Still not enough? OK, in the server buffer Still not enough? OK, in the server buffer
@code{gnus-group-make-search-group} (now bound to @kbd{G}) will search @code{gnus-group-read-ephemeral-search-group} (now bound to @kbd{G})
all groups from the server on the current line. Too much? Want to will search all groups from the server on the current line. Too much?
ignore certain groups when searching, like spam groups? Just Want to ignore certain groups when searching, like spam groups? Just
customize @code{nnir-ignored-newsgroups}. customize @code{nnir-ignored-newsgroups}.
One more thing: individual search engines may have special search One more thing: individual search engines may have special search
features. You can access these special features by giving a prefix-arg features. You can access these special features by giving a
to @code{gnus-group-make-search-group}. If you are searching multiple prefix-arg to @code{gnus-group-read-ephemeral-search-group}. If you
groups with different search engines you will be prompted for the are searching multiple groups with different search engines you will
special search features for each engine separately. be prompted for the special search features for each engine
separately.
@node Setting up nnir @node Setting up nnir

View file

@ -333,12 +333,18 @@ arbitrary list of articles that may come from multiple groups and
servers. These groups generally behave like any other group: they may servers. These groups generally behave like any other group: they may
be ephemeral or persistent, and allow article marking, moving, be ephemeral or persistent, and allow article marking, moving,
deletion, etc. 'nnselect' groups may be created like any other group, deletion, etc. 'nnselect' groups may be created like any other group,
but there is also a convenience function for the common case of but there are three convenience functions for the common case of
obtaining the list of articles as a result of a search: obtaining the list of articles as a result of a search:
'gnus-group-make-search-group' ('G g') that will prompt for an 'nnir' 'gnus-group-make-search-group' ('G g') that will prompt for an 'nnir'
search query and create a dedicated group for that search. As part of search query and create a persistent group for that search;
this addition, the user option 'nnir-summary-line-format' has been 'gnus-group-read-ephemeral-search-group' ('G G') that will prompt for
removed; its functionality is now available directly in the an 'nnir' search query and create an ephemeral group for that search;
and 'gnus-summary-make-group-from-search' ('C-c C-p') that will create
a persistent group with the search parameters of a current ephemeral
search group.
As part of this addition, the user option 'nnir-summary-line-format'
has been removed; its functionality is now available directly in the
'gnus-summary-line-format' specs '%G' and '%g'. The user option 'gnus-summary-line-format' specs '%G' and '%g'. The user option
'gnus-refer-thread-use-nnir' has been renamed to 'gnus-refer-thread-use-nnir' has been renamed to
'gnus-refer-thread-use-search'. 'gnus-refer-thread-use-search'.

View file

@ -87,6 +87,7 @@
(autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t) (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
(autoload 'nnselect-article-rsv "nnselect" nil nil) (autoload 'nnselect-article-rsv "nnselect" nil nil)
(autoload 'nnselect-article-group "nnselect" nil nil) (autoload 'nnselect-article-group "nnselect" nil nil)
(autoload 'gnus-nnselect-group-p "nnselect" nil nil)
(defcustom gnus-kill-summary-on-exit t (defcustom gnus-kill-summary-on-exit t
"If non-nil, kill the summary buffer when you exit from it. "If non-nil, kill the summary buffer when you exit from it.
@ -1989,6 +1990,7 @@ increase the score of each group you read."
"\M-K" gnus-summary-edit-global-kill "\M-K" gnus-summary-edit-global-kill
;; "V" gnus-version ;; "V" gnus-version
"\C-c\C-d" gnus-summary-describe-group "\C-c\C-d" gnus-summary-describe-group
"\C-c\C-p" gnus-summary-make-group-from-search
"q" gnus-summary-exit "q" gnus-summary-exit
"Q" gnus-summary-exit-no-update "Q" gnus-summary-exit-no-update
"\C-c\C-i" gnus-info-find-node "\C-c\C-i" gnus-info-find-node
@ -7120,6 +7122,21 @@ The prefix argument ALL means to select all articles."
(setq info (copy-sequence (gnus-get-info group)) (setq info (copy-sequence (gnus-get-info group))
info (delq (gnus-info-params info) info)))))))))) info (delq (gnus-info-params info) info))))))))))
(defun gnus-summary-make-group-from-search ()
"Make a persistent group from the current ephemeral search group."
(interactive)
(if (not (gnus-nnselect-group-p gnus-newsgroup-name))
(gnus-message 3 "%s is not a search group" gnus-newsgroup-name)
(let ((name (gnus-read-group "Group name: ")))
(with-current-buffer gnus-group-buffer
(gnus-group-make-group
name
(list 'nnselect "nnselect")
nil
(list (cons 'nnselect-specs
(gnus-group-get-parameter gnus-newsgroup-name
'nnselect-specs t))))))))
(defun gnus-summary-save-newsrc (&optional force) (defun gnus-summary-save-newsrc (&optional force)
"Save the current number of read/marked articles in the dribble buffer. "Save the current number of read/marked articles in the dribble buffer.
The dribble buffer will then be saved. The dribble buffer will then be saved.