define-minor-mode: sanitize mode function messages

* emacs-lisp/easy-mmode.el (define-minor-mode): Ensure mode's
pretty name is not interprted as a message formatting string,
e.g., if the mode name contains a '%'.  (Bug#63343)
This commit is contained in:
Nicholas Vollmer 2023-05-07 00:06:18 -04:00 committed by Eli Zaretskii
parent 910a7b30df
commit e920dd2b6f

View file

@ -390,7 +390,7 @@ or call the function `%s'."))))
(not (equal ,last-message
(current-message))))
(let ((local ,(if globalp "" " in current buffer")))
(message ,(format "%s %%sabled%%s" pretty-name)
(message "%s %sabled%s" ,pretty-name
(if ,getter "en" "dis") local)))))
,@(when after-hook `(,after-hook)))
(force-mode-line-update)