Don't use deprecated unload-hook variables in Gnus

* 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
This commit is contained in:
Stefan Kangas 2025-02-10 00:40:23 +01:00
parent 1c16d81bac
commit ceef902594
3 changed files with 17 additions and 12 deletions

View 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

View 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)

View 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