From 98c1a20b6c68de1801b9373cce602cd1d576e816 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Fri, 12 Jul 2024 19:57:45 +0200 Subject: [PATCH] Only say that minor mode function is interactive if it is so --- lisp/emacs-lisp/easy-mmode.el | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 45e547a7f63..f5a9f443f2a 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -82,11 +82,7 @@ replacing its case-insensitive matches with the literal string in LIGHTER." (replace-regexp-in-string (regexp-quote lighter) lighter name t t)))) (defconst easy-mmode--arg-docstring - "This is a %sminor mode. If called interactively, toggle the -`%s' mode. If the prefix argument is positive, enable the mode, -and if it is zero or negative, disable the mode. - -If called from Lisp, toggle the mode if ARG is `toggle'. + "This is a %sminor mode. %soggle the mode if ARG is `toggle'. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. @@ -97,7 +93,7 @@ The mode's hook is called both when the mode is enabled and when it is disabled.") (defun easy-mmode--mode-docstring (doc mode-pretty-name keymap-sym - getter global) + getter global interactive) ;; If we have a doc string, and it's already complete (which we ;; guess at with the simple heuristic below), then just return that ;; as is. @@ -127,7 +123,13 @@ it is disabled.") (argdoc (format easy-mmode--arg-docstring (if global "global " "") - mode-pretty-name + (if interactive + (format "If called interactively, toggle the +`%s' mode. If the prefix argument is positive, enable the mode, +and if it is zero or negative, disable the mode. + +If called from Lisp, t" mode-pretty-name) + "T") ;; Avoid having quotes turn into pretty quotes. (string-replace "'" "\\='" (format "%S" getter))))) (let ((start (point))) @@ -336,7 +338,7 @@ or call the function `%s'.")))) warnwrap `(defun ,modefun (&optional arg ,@extra-args) ,(easy-mmode--mode-docstring doc pretty-name keymap-sym - getter globalp) + getter globalp interactive) ,(when interactive ;; Use `toggle' rather than (if ,mode 0 1) so that using ;; repeat-command still does the toggling correctly. -- 2.39.2