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

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

[elpa] externals/gnorb a59dac2 317/449: Use hook for determining Gnorb s


From: Stefan Monnier
Subject: [elpa] externals/gnorb a59dac2 317/449: Use hook for determining Gnorb summary minor mode
Date: Fri, 27 Nov 2020 23:16:03 -0500 (EST)

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

    Use hook for determining Gnorb summary minor mode
    
    * gnorb-gnus.el (gnorb-gnus-search-messages): Don't start the minor mode
      from here, this is no longer the only entry point to Gnorb-generated
      groups. Just identify our nnir groups as Gnorb-related.
      (gnorb-gnus-summary-mode-hook): Check when entering all
      groups if this is a Gnorb-generated group. If so, activate the minor
      mode.
    
    This is about as far as we're going to go down this road. Next up is
    making nngnorb a proper backend, with real groups.
---
 gnorb-gnus.el | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/gnorb-gnus.el b/gnorb-gnus.el
index 970bc74..38c8d90 100644
--- a/gnorb-gnus.el
+++ b/gnorb-gnus.el
@@ -679,7 +679,7 @@ work."
                   (concat "gnorb-" str))))
     (setq method (if (version= "5.13" gnus-version-number)
                     (list 'nnir nnir-address)
-                  (list 'nnir "nnir")))
+                  (list 'nnir "Gnorb")))
     (setq spec
          (list
           (cons 'nnir-specs (list (cons 'nnir-query-spec `((query . ,str)))
@@ -690,8 +690,16 @@ work."
          (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)))
+     (gnus-group-read-ephemeral-group name method nil ret nil nil spec))))
+
+(defun gnorb-gnus-summary-mode-hook ()
+  "Check if we've entered a Gnorb-generated group, and activate
+  `gnorb-summary-minor-mode', if so."
+  (let ((method (gnus-find-method-for-group gnus-newsgroup-name)))
+    (when (string-match-p "Gnorb" (cadr method))
+      (gnorb-summary-minor-mode))))
+
+(add-hook 'gnus-summary-mode-hook #'gnorb-gnus-summary-mode-hook)
 
 ;;; Automatic noticing of relevant messages
 



reply via email to

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