From bad2cd198abbd150cc205aee7879ad718e724dad Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 14 Mar 2025 19:50:22 +0100 Subject: [PATCH] Make turn-on-flyspell/turn-off-flyspell obsolete * lisp/textmodes/flyspell.el (turn-on-flyspell): Make into obsolete function alias for 'flyspell-mode'. (turn-off-flyspell): Declare obsolete. (text-mode-hook): Don't redundantly set :options here. * lisp/textmodes/text-mode.el (text-mode-hook): Prefer 'flyspell-mode' to 'turn-on-flyspell' in :options. (Bug#76535) --- etc/NEWS | 6 ++++++ lisp/textmodes/flyspell.el | 21 +++++++++------------ lisp/textmodes/text-mode.el | 3 ++- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index e634de18c69..b33f7cec73f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1065,6 +1065,12 @@ allows idle timers and other code to run during this delay period. We consider making this behavior the default in a future Emacs version, so we invite Flyspell users to enable this new option and report issues. +--- +*** 'turn-on-flyspell' and 'turn-off-flyspell' are obsolete. +To unconditionally enable 'flyspell-mode' from a hook, use this instead: + + (add-hook 'text-mode-hook #'flyspell-mode) + ** Tramp +++ diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index b25f39c440b..d62c3fd135d 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -530,18 +530,6 @@ in your init file. (flyspell-mode -1))) (flyspell--mode-off))) -;;;###autoload -(defun turn-on-flyspell () - "Unconditionally turn on Flyspell mode." - (flyspell-mode 1)) - -;;;###autoload -(defun turn-off-flyspell () - "Unconditionally turn off Flyspell mode." - (flyspell-mode -1)) - -(custom-add-option 'text-mode-hook 'turn-on-flyspell) - (defvar flyspell-buffers nil "For remembering buffers running flyspell.") (make-obsolete-variable 'flyspell-buffers "not used." "28.1") @@ -2408,6 +2396,15 @@ This function is meant to be added to `flyspell-incorrect-hook'." (define-obsolete-function-alias 'flyspell-mode-on 'flyspell--mode-on "30.1") (define-obsolete-function-alias 'flyspell-mode-off 'flyspell--mode-off "30.1") +;;;###autoload +(define-obsolete-function-alias 'turn-on-flyspell #'flyspell-mode "31.1") + +;;;###autoload +(defun turn-off-flyspell () + "Unconditionally turn off Flyspell mode." + (declare (obsolete flyspell-mode "31.1")) + (flyspell-mode -1)) + (provide 'flyspell) ;;; flyspell.el ends here diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el index cfacb144e40..3b27efbcf87 100644 --- a/lisp/textmodes/text-mode.el +++ b/lisp/textmodes/text-mode.el @@ -34,7 +34,8 @@ (defcustom text-mode-hook '(text-mode-hook-identify) "Normal hook run when entering Text mode and many related modes." :type 'hook - :options '(turn-on-auto-fill turn-on-flyspell) + :options '(turn-on-auto-fill flyspell-mode) + :version "31.1" :group 'text) (defvar text-mode-variant nil