emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/gnorb 0f18c45 311/449: Allow persistent nnir search gro


From: Stefan Monnier
Subject: [elpa] externals/gnorb 0f18c45 311/449: Allow persistent nnir search groups
Date: Fri, 27 Nov 2020 23:16:01 -0500 (EST)

branch: externals/gnorb
commit 0f18c45e28b46c0667a9f02be6052a761e969c4a
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    Allow persistent nnir search groups
    
    * gnorb-gnus.el (gnorb-gnus-search-messages): If argument "persist" is
      non-nil, create the search group with `gnus-group-make-group' instead
      of `gnus-group-read-ephemeral-group'.
    
    * gnorb-org.el (gnorb-org-view): Use the prefix arg as the "persist"
      argument; do a bit of other prep-work.
    
    * gnorb.org: Document.
    * gnorb.texi:
    * gnorb.info:
---
 gnorb-gnus.el | 41 ++++++++++++++++++++++++-----------------
 gnorb-org.el  | 14 ++++++++++----
 gnorb.info    | 54 ++++++++++++++++++++++++++++++------------------------
 gnorb.org     | 15 ++++++++++-----
 gnorb.texi    | 15 ++++++++++-----
 5 files changed, 84 insertions(+), 55 deletions(-)

diff --git a/gnorb-gnus.el b/gnorb-gnus.el
index dda2c07..70fee1b 100644
--- a/gnorb-gnus.el
+++ b/gnorb-gnus.el
@@ -637,7 +637,7 @@ reply."
       (message "No associated headings found"))))
 
 ;;;###autoload
-(defun gnorb-gnus-search-messages (str &optional ret)
+(defun gnorb-gnus-search-messages (str persist &optional head-text ret)
   "Initiate a search for gnus message links in an org subtree.
 The arg STR can be one of two things: an Org heading id value
 \(IDs should be prefixed with \"id+\"\), in which case links will
@@ -654,30 +654,37 @@ work."
   (let ((nnir-address
         (or (gnus-method-to-server '(nngnorb))
             (user-error
-             "Please add a \"nngnorb\" backend to your gnus installation."))))
+             "Please add a \"nngnorb\" backend to your gnus installation.")))
+       name method spec)
     (when (version= "5.13" gnus-version-number)
       (with-no-warnings                  ; All these variables are available.
        (setq nnir-current-query nil
              nnir-current-server nil
              nnir-current-group-marked nil
              nnir-artlist nil)))
-    (gnus-group-read-ephemeral-group
-     ;; in 24.4, the group name is mostly decorative. in 24.3, the
-     ;; query itself is read from there. It should look like (concat
-     ;; "nnir:" (prin1-to-string '((query str))))
-     (if (version= "5.13" gnus-version-number)
-        (concat "nnir:" (prin1-to-string `((query ,str))))
-       (concat "gnorb-" str))
-     (if (version= "5.13" gnus-version-number)
-        (list 'nnir nnir-address)
-       (list 'nnir "nnir"))
-     nil
-     ret
-     nil nil
-     ;; the following seems to simply be ignored under gnus 5.13
-     (list (cons 'nnir-specs (list (cons 'nnir-query-spec `((query . ,str)))
+    ;; In 24.4, the group name is mostly decorative, but in 24.3, the
+    ;; actual query is held there.
+    (setq name (if (version= "5.13" gnus-version-number)
+                  (concat "nnir:" (prin1-to-string `((query ,str))))
+                (if persist
+                    (read-string
+                     (format "Name for group (default %s): " head-text)
+                     nil head-text t)
+                  (concat "gnorb-" str))))
+    (setq method (if (version= "5.13" gnus-version-number)
+                    (list 'nnir nnir-address)
+                  (list 'nnir "nnir")))
+    (setq spec
+         (list
+          (cons 'nnir-specs (list (cons 'nnir-query-spec `((query . ,str)))
                                   (cons 'nnir-group-spec `((,nnir-address 
nil)))))
           (cons 'nnir-artlist nil)))
+    (if persist
+       (progn
+         (switch-to-buffer gnus-group-buffer)
+         (gnus-group-make-group name method nil spec)
+         (gnus-group-select-group))
+     (gnus-group-read-ephemeral-group name method nil ret nil nil spec))
     (gnorb-summary-minor-mode)))
 
 ;;; Automatic noticing of relevant messages
diff --git a/gnorb-org.el b/gnorb-org.el
index 0af2f84..e68fcff 100644
--- a/gnorb-org.el
+++ b/gnorb-org.el
@@ -645,14 +645,17 @@ search."
 ;;; Groups from the gnorb gnus server backend
 
 ;;;###autoload
-(defun gnorb-org-view ()
+(defun gnorb-org-view (arg)
   "Search the subtree at point for links to gnus messages, and
-then show them in an ephemeral group, in gnus.
+then show them in an ephemeral group, in Gnus.
+
+With a prefix arg, create a search group that will persist across
+Gnus sessions, and can be refreshed.
 
 This won't work unless you've added a \"nngnorb\" server to
 your gnus select methods."
   ;; this should also work on the active region, if there is one.
-  (interactive)
+  (interactive "P")
   (require 'gnorb-gnus)
   (setq gnorb-window-conf (current-window-configuration))
   (move-marker gnorb-return-marker (point))
@@ -671,7 +674,10 @@ your gnus select methods."
       (org-back-to-heading)
       (setq id (concat "id+" (org-id-get-create)))
       (gnorb-gnus-search-messages
-       id
+       id arg
+       (replace-regexp-in-string
+       org-bracket-link-regexp "\\3"
+       (nth 4 (org-heading-components)))
        `(when (and (window-configuration-p gnorb-window-conf)
                   gnorb-return-marker)
          (set-window-configuration gnorb-window-conf)
diff --git a/gnorb.info b/gnorb.info
index 3d5141f..4cd23ef 100644
--- a/gnorb.info
+++ b/gnorb.info
@@ -252,12 +252,18 @@ File: gnorb.info,  Node: Viewing Tracked Messages in 
*Summary* Buffers,  Next: H
 =================================================
 
 Call ‘gnorb-org-view’ on an Org heading to open an nnir *Summary* buffer
-showing all the messages associated with that heading (this requires
-that you’ve added an nngnorb server to your Gnus backends).  A minor
-mode will be in effect, ensuring that any replies you send to messages
-in this buffer will automatically be associated with the original Org
-heading.  You can also invoke ‘gnorb-summary-disassociate-message’ (“C-c
-d”) to disassociate the message with the Org heading.
+showing all the messages associated with that heading and child headings
+(this requires that you’ve added an nngnorb server to your Gnus
+backends).  A minor mode will be in effect, ensuring that any replies
+you send to messages in this buffer will automatically be associated
+with the original Org heading.  You can also invoke
+‘gnorb-summary-disassociate-message’ (“C-c d”) to disassociate the
+message with the Org heading.
+
+   If you call ‘gnorb-org-view’ with a prefix argument, the search group
+will be made persistent across Gnus sessions.  You can re-run the search
+and update the group contents by hitting “M-g” on the group in the Gnus
+*Group* buffer.
 
    As a bonus, it’s possible to go into Gnus’ *Server* buffer, find the
 line specifying your nngnorb server, and hit “G” (aka
@@ -707,24 +713,24 @@ Node: Email Tracking3899
 Node: Email-Related Commands5430
 Node: Trigger Actions8801
 Node: Viewing Tracked Messages in *Summary* Buffers9650
-Node: Hinting in Gnus10884
-Node: Message Attachments11892
-Node: Likely Workflow13074
-Node: Restoring Window Layout15879
-Node: Recent Mails From BBDB Contacts16243
-Node: BBDB posting styles17239
-Node: BBDB Org tagging18155
-Node: Misc BBDB18901
-Node: Searching for messages from BBDB contacts19114
-Node: Citing BBDB contacts19560
-Node: User Options19881
-Node: Misc Org21420
-Node: Inserting BBDB links21595
-Node: User Optionsx21850
-Node: Misc Gnus24587
-Node: Viewing Org headlines relevant to a message24800
-Node: User Optionsxx25115
-Node: Suggested Keybindings27879
+Node: Hinting in Gnus11146
+Node: Message Attachments12154
+Node: Likely Workflow13336
+Node: Restoring Window Layout16141
+Node: Recent Mails From BBDB Contacts16505
+Node: BBDB posting styles17501
+Node: BBDB Org tagging18417
+Node: Misc BBDB19163
+Node: Searching for messages from BBDB contacts19376
+Node: Citing BBDB contacts19822
+Node: User Options20143
+Node: Misc Org21682
+Node: Inserting BBDB links21857
+Node: User Optionsx22112
+Node: Misc Gnus24849
+Node: Viewing Org headlines relevant to a message25062
+Node: User Optionsxx25377
+Node: Suggested Keybindings28141
 
 End Tag Table
 
diff --git a/gnorb.org b/gnorb.org
index da0f101..380f657 100644
--- a/gnorb.org
+++ b/gnorb.org
@@ -158,14 +158,19 @@ docstring of `gnorb-org-trigger-actions'.
 :PROPERTIES:
 :END:
 Call `gnorb-org-view' on an Org heading to open an nnir *Summary*
-buffer showing all the messages associated with that heading (this
-requires that you've added an nngnorb server to your Gnus backends). A
-minor mode will be in effect, ensuring that any replies you send to
-messages in this buffer will automatically be associated with the
-original Org heading. You can also invoke
+buffer showing all the messages associated with that heading and child
+headings (this requires that you've added an nngnorb server to your
+Gnus backends). A minor mode will be in effect, ensuring that any
+replies you send to messages in this buffer will automatically be
+associated with the original Org heading. You can also invoke
 `gnorb-summary-disassociate-message' ("C-c d") to disassociate the
 message with the Org heading.
 
+If you call `gnorb-org-view' with a prefix argument, the search group
+will be made persistent across Gnus sessions. You can re-run the
+search and update the group contents by hitting "M-g" on the group in
+the Gnus *Group* buffer.
+
 As a bonus, it's possible to go into Gnus' *Server* buffer, find the
 line specifying your nngnorb server, and hit "G" (aka
 `gnus-group-make-nnir-group'). At the query prompt, enter an Org-style
diff --git a/gnorb.texi b/gnorb.texi
index 675af08..1cd0ce5 100644
--- a/gnorb.texi
+++ b/gnorb.texi
@@ -261,14 +261,19 @@ docstring of `gnorb-org-trigger-actions'.
 @section Viewing Tracked Messages in *Summary* Buffers
 
 Call `gnorb-org-view' on an Org heading to open an nnir *Summary*
-buffer showing all the messages associated with that heading (this
-requires that you've added an nngnorb server to your Gnus backends). A
-minor mode will be in effect, ensuring that any replies you send to
-messages in this buffer will automatically be associated with the
-original Org heading. You can also invoke
+buffer showing all the messages associated with that heading and child
+headings (this requires that you've added an nngnorb server to your
+Gnus backends). A minor mode will be in effect, ensuring that any
+replies you send to messages in this buffer will automatically be
+associated with the original Org heading. You can also invoke
 `gnorb-summary-disassociate-message' (``C-c d'') to disassociate the
 message with the Org heading.
 
+If you call `gnorb-org-view' with a prefix argument, the search group
+will be made persistent across Gnus sessions. You can re-run the
+search and update the group contents by hitting ``M-g'' on the group in
+the Gnus *Group* buffer.
+
 As a bonus, it's possible to go into Gnus' *Server* buffer, find the
 line specifying your nngnorb server, and hit ``G'' (aka
 `gnus-group-make-nnir-group'). At the query prompt, enter an Org-style



reply via email to

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