]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't use deprecated unload-hook variables in Gnus
authorStefan Kangas <stefankangas@gmail.com>
Sun, 9 Feb 2025 23:40:23 +0000 (00:40 +0100)
committerEshel Yaron <me@eshelyaron.com>
Mon, 10 Feb 2025 20:56:23 +0000 (21:56 +0100)
* lisp/gnus/gnus-registry.el (gnus-registry-unload-hook):
* lisp/gnus/spam-stat.el (spam-stat-unload-hook):
* lisp/gnus/spam.el (spam-unload-hook): Rename functions from this...

* lisp/gnus/gnus-registry.el (gnus-registry-unload-function):
* lisp/gnus/spam-stat.el (spam-stat-unload-function):
* lisp/gnus/spam.el (spam-unload-function): ...to this.  Don't set the
corresponding variables, always return nil, update callers, and leave
old name as obsolete function aliases.
Ref: https://lists.gnu.org/r/emacs-devel/2025-02/msg00294.html

(cherry picked from commit ceef9025944fd3d51122f913ed9a74a259db55f7)

lisp/gnus/gnus-registry.el
lisp/gnus/spam-stat.el
lisp/gnus/spam.el

index c4c1c649e1e9d5a6c94c4cd0824cfa96e628edf2..0d7282d73da816090c49f011549ad9914b65f4c3 100644 (file)
@@ -1174,7 +1174,7 @@ non-nil."
 
 (defun gnus-registry-clear ()
   "Clear the registry."
-  (gnus-registry-unload-hook)
+  (gnus-registry-unload-function)
   (setq gnus-registry-db nil))
 
 (gnus-add-shutdown 'gnus-registry-clear 'gnus)
@@ -1198,7 +1198,7 @@ non-nil."
 
   (add-hook 'gnus-summary-prepare-hook #'gnus-registry-register-message-ids))
 
-(defun gnus-registry-unload-hook ()
+(defun gnus-registry-unload-function ()
   "Uninstall the registry hooks."
   (remove-hook 'gnus-summary-article-move-hook #'gnus-registry-action)
   (remove-hook 'gnus-summary-article-delete-hook #'gnus-registry-action)
@@ -1208,9 +1208,8 @@ non-nil."
   (remove-hook 'gnus-save-newsrc-hook #'gnus-registry-save)
   (remove-hook 'gnus-read-newsrc-el-hook #'gnus-registry-load)
 
-  (remove-hook 'gnus-summary-prepare-hook #'gnus-registry-register-message-ids))
-
-(add-hook 'gnus-registry-unload-hook #'gnus-registry-clear)
+  (remove-hook 'gnus-summary-prepare-hook #'gnus-registry-register-message-ids)
+  nil)
 
 (defun gnus-registry-install-p ()
   "Return non-nil if the registry is enabled (and maybe enable it first).
@@ -1297,6 +1296,9 @@ from your existing entries."
                 (gnus-registry-insert db k newv)))
       (registry-reindex db))))
 
+(define-obsolete-function-alias 'gnus-registry-unload-hook
+  #'gnus-registry-unload-function "31.1")
+
 (provide 'gnus-registry)
 
 ;;; gnus-registry.el ends here
index 61f0b1322017b3fde76f7fc6ed284d321b5dab36..b4698e9b2b6226fbb2e7f61df757fada01fce53a 100644 (file)
@@ -643,15 +643,17 @@ COUNT defaults to 5"
   (add-hook 'gnus-select-article-hook
            #'spam-stat-store-gnus-article-buffer))
 
-(defun spam-stat-unload-hook ()
+(defun spam-stat-unload-function ()
   "Uninstall the spam-stat function hooks."
   (interactive)
   (remove-hook 'nnmail-prepare-incoming-message-hook
               #'spam-stat-store-current-buffer)
   (remove-hook 'gnus-select-article-hook
-              #'spam-stat-store-gnus-article-buffer))
+              #'spam-stat-store-gnus-article-buffer)
+  nil)
 
-(add-hook 'spam-stat-unload-hook #'spam-stat-unload-hook)
+(define-obsolete-function-alias 'spam-stat-unload-hook
+  #'spam-stat-unload-function "31.1")
 
 (provide 'spam-stat)
 
index dab68332ec5063db5f89f36759028eae047d1e97..5c25df049e3756a84260098efa2428f311ca410f 100644 (file)
@@ -2854,7 +2854,7 @@ installed through `spam-necessary-extra-headers'."
     ;; Don't install things more than once.
     (setq spam-install-hooks nil)))
 
-(defun spam-unload-hook ()
+(defun spam-unload-function ()
   "Uninstall the spam.el hooks."
   (interactive)
   (spam-teardown-widening)
@@ -2864,12 +2864,13 @@ installed through `spam-necessary-extra-headers'."
   (remove-hook 'gnus-summary-prepare-exit-hook #'spam-summary-prepare-exit)
   (remove-hook 'gnus-summary-prepare-hook #'spam-summary-prepare)
   (remove-hook 'gnus-get-new-news-hook #'spam-setup-widening)
-  (remove-hook 'gnus-summary-prepare-hook #'spam-find-spam))
-
-(add-hook 'spam-unload-hook #'spam-unload-hook)
+  (remove-hook 'gnus-summary-prepare-hook #'spam-find-spam)
+  nil)
 
 ;;}}}
 
+(define-obsolete-function-alias 'spam-unload-hook #'spam-unload-function "31.1")
+
 (provide 'spam)
 
 ;;; spam.el ends here