emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master c50643c: Add Gnus function to make a persistent group from a sear


From: Andrew G Cohen
Subject: master c50643c: Add Gnus function to make a persistent group from a search result
Date: Tue, 8 Sep 2020 22:06:32 -0400 (EDT)

branch: master
commit c50643cebd762ca77c6f2bc90264e4ef04dcb43d
Author: Andrew G Cohen <cohen@andy.bu.edu>
Commit: Andrew G Cohen <cohen@andy.bu.edu>

    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.
---
 doc/misc/gnus.texi    | 51 +++++++++++++++++++++++++++++++--------------------
 etc/NEWS              | 14 ++++++++++----
 lisp/gnus/gnus-sum.el | 17 +++++++++++++++++
 3 files changed, 58 insertions(+), 24 deletions(-)

diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 6044166..176411a 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -21452,19 +21452,29 @@ maintained outside of Gnus.
 @subsection Basic Usage
 
 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
-for a query string, creates an ephemeral @code{nnselect} group containing
-the articles that match this query, and takes you to a summary buffer
-showing these articles.  Articles may then be read, moved and deleted
-using the usual commands.
-
-The @code{nnselect} group made in this way is an @code{ephemeral}
-group, and will disappear upon exit from the group.  However changes
-made in the group are permanently reflected in the real groups from
-which the articles are drawn.  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}.
+current line by calling @code{gnus-group-read-ephemeral-search-group}.
+This prompts for a query string, creates an ephemeral @code{nnselect}
+group containing the articles that match this query, and takes you to
+a summary buffer showing these articles.   Articles may then be read,
+moved and deleted using the usual commands.
+
+The @code{nnselect} group made in this way is @code{ephemeral}: it
+will disappear upon exit from the group.  However changes made in the
+group are permanently reflected in the real groups from which the
+articles are drawn.  If you want to create a @emph{persistent} group
+that sticks around after exit from the summary buffer, you can call
+@code{gnus-group-make-search-group} (bound to @kbd{G g}).
+
+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?
 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.
 
 Still not enough?  OK, in the server buffer
-@code{gnus-group-make-search-group} (now bound to @kbd{G}) will search
-all groups from the server on the current line.  Too much?  Want to
-ignore certain groups when searching, like spam groups?  Just
+@code{gnus-group-read-ephemeral-search-group} (now bound to @kbd{G})
+will search all groups from the server on the current line.  Too much?
+Want to ignore certain groups when searching, like spam groups?  Just
 customize @code{nnir-ignored-newsgroups}.
 
 One more thing: individual search engines may have special search
-features.  You can access these special features by giving a prefix-arg
-to @code{gnus-group-make-search-group}.  If you are searching multiple
-groups with different search engines you will be prompted for the
-special search features for each engine separately.
+features.  You can access these special features by giving a
+prefix-arg to @code{gnus-group-read-ephemeral-search-group}.  If you
+are searching multiple groups with different search engines you will
+be prompted for the special search features for each engine
+separately.
 
 
 @node Setting up nnir
diff --git a/etc/NEWS b/etc/NEWS
index fd6cdbe..76f44f2 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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
 be ephemeral or persistent, and allow article marking, moving,
 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:
 '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
-this addition, the user option 'nnir-summary-line-format' has been
-removed; its functionality is now available directly in the
+search query and create a persistent group for that search;
+'gnus-group-read-ephemeral-search-group' ('G G') that will prompt for
+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-refer-thread-use-nnir' has been renamed to
 'gnus-refer-thread-use-search'.
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 8042743..45397b5 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -87,6 +87,7 @@
 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
 (autoload 'nnselect-article-rsv "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
   "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
   ;; "V" gnus-version
   "\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-no-update
   "\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))
                          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)
   "Save the current number of read/marked articles in the dribble buffer.
 The dribble buffer will then be saved.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]