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

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

[elpa] master b1e2594: [gnorb] Add a gnus-shutdown to clean up gnorb hoo


From: Eric Abrahamsen
Subject: [elpa] master b1e2594: [gnorb] Add a gnus-shutdown to clean up gnorb hooks, bump to 1.6.4
Date: Tue, 8 Oct 2019 14:39:36 -0400 (EDT)

branch: master
commit b1e2594df47091c0b1e651147c8350984d85c601
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    [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.
---
 packages/gnorb/gnorb-gnus.el | 23 ++++++++++++++++-------
 packages/gnorb/gnorb.el      |  2 +-
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/packages/gnorb/gnorb-gnus.el b/packages/gnorb/gnorb-gnus.el
index 6dbda6e..9c6e354 100644
--- a/packages/gnorb/gnorb-gnus.el
+++ b/packages/gnorb/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/packages/gnorb/gnorb.el b/packages/gnorb/gnorb.el
index 89cec18..6e37738 100644
--- a/packages/gnorb/gnorb.el
+++ b/packages/gnorb/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 <address@hidden>



reply via email to

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