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

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

[elpa] externals/gnorb 6d88203 432/449: [gnorb] Add a gnus-shutdown to c


From: Stefan Monnier
Subject: [elpa] externals/gnorb 6d88203 432/449: [gnorb] Add a gnus-shutdown to clean up gnorb hooks, bump to 1.6.4
Date: Fri, 27 Nov 2020 23:16:27 -0500 (EST)

branch: externals/gnorb
commit 6d88203d489846cb2720a64da530f9338cf3b5a8
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    [gnorb] Add a gnus-shutdown to clean up gnorb hooks, bump to 1.6.4
    
    * packages/gnorb/gnorb-gnus.el (gnorb-gnus-hint-relevant-message):
    Also check that the gnus-registry-db exists here. At some point in the
    future, these checks should be changed to gnus-registry-enabled, but
    not yet.
    * packages/gnorb/gnorb-gnus.el (gnorb-gnus-startup): Move main
    add-hooks into this function, run it on gnus-started-hook.
     (gnorb-gnus-shutdown): Add this new function to gnus-shutdown-alist,
     removing the hooks.
---
 gnorb-gnus.el | 23 ++++++++++++++++-------
 gnorb.el      |  2 +-
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/gnorb-gnus.el b/gnorb-gnus.el
index 6dbda6e..9c6e354 100644
--- a/gnorb-gnus.el
+++ b/gnorb-gnus.el
@@ -328,7 +328,7 @@ information about the outgoing message into
                         'gnorb-org-restore-after-send t))
        (setq gnorb-message-org-ids nil)))))
 
-(add-hook 'message-sent-hook 'gnorb-gnus-check-outgoing-headers t)
+(add-hook 'message-sent-hook #'gnorb-gnus-check-outgoing-headers t)
 
 ;;;###autoload
 (defun gnorb-gnus-outgoing-do-todo (&optional arg)
@@ -941,8 +941,6 @@ error."
     (when (string-match-p "Gnorb" (cadr method))
       (gnorb-summary-minor-mode))))
 
-(add-hook 'gnus-summary-prepared-hook #'gnorb-gnus-summary-mode-hook)
-
 ;;; Automatic noticing of relevant messages
 
 ;; likely hooks for the summary buffer include:
@@ -958,6 +956,7 @@ to that effect. This function is added to the
 `gnus-article-prepare-hook'. It will only do anything if the
 option `gnorb-gnus-hint-relevant-article' is non-nil."
   (when (and gnorb-gnus-hint-relevant-article
+            (eieio-object-p gnus-registry-db)
             (not (memq (car (gnus-find-method-for-group
                              gnus-newsgroup-name))
                        '(nnvirtual nnir))))
@@ -983,10 +982,8 @@ option `gnorb-gnus-hint-relevant-article' is non-nil."
                        "M-x gnorb-gnus-incoming-do-todo")))
            (t nil)))))
 
-(add-hook 'gnus-select-article-hook 'gnorb-gnus-hint-relevant-message)
-
 (defun gnorb-gnus-insert-format-letter-maybe (header)
-  (if (object-p gnus-registry-db)
+  (if (eieio-object-p gnus-registry-db)
       (if (not (or (gnus-ephemeral-group-p gnus-newsgroup-name)
                   (gnus-virtual-group-p gnus-newsgroup-name)))
          (let* ((id (mail-header-message-id header))
@@ -1010,7 +1007,7 @@ option `gnorb-gnus-hint-relevant-article' is non-nil."
     (gnorb-gnus-insert-format-letter-maybe header)))
 
 (defun gnorb-gnus-insert-format-tags (header)
-  (if (object-p gnus-registry-db)
+  (if (eieio-object-p gnus-registry-db)
       (let* ((id (mail-header-message-id header))
             (entry (nth 1 (assoc id (registry-lookup
                                      gnus-registry-db
@@ -1042,5 +1039,17 @@ option `gnorb-gnus-hint-relevant-article' is non-nil."
       (delete-other-windows)
       (org-id-goto (car tracked-headings)))))
 
+(defun gnorb-gnus-startup ()
+  (add-hook 'gnus-select-article-hook #'gnorb-gnus-hint-relevant-message)
+  (add-hook 'gnus-summary-prepared-hook #'gnorb-gnus-summary-mode-hook))
+
+(add-hook 'gnus-started-hook #'gnorb-gnus-startup)
+
+(defun gnorb-gnus-shutdown ()
+  (remove-hook 'gnus-select-article-hook #'gnorb-gnus-hint-relevant-message)
+  (remove-hook 'gnus-summary-prepared-hook #'gnorb-gnus-summary-mode-hook))
+
+(gnus-add-shutdown #'gnorb-gnus-shutdown 'gnus)
+
 (provide 'gnorb-gnus)
 ;;; gnorb-gnus.el ends here
diff --git a/gnorb.el b/gnorb.el
index 846401f..a189e09 100644
--- a/gnorb.el
+++ b/gnorb.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2018  Free Software Foundation, Inc.
 
-;; Version: 1.6.3
+;; Version: 1.6.4
 ;; Package-Requires: ((cl-lib "0.5"))
 
 ;; Maintainer: Eric Abrahamsen <eric@ericabrahamsen.net>



reply via email to

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