]> git.eshelyaron.com Git - emacs.git/commitdiff
Only say that minor mode function is interactive if it is so
authorEshel Yaron <me@eshelyaron.com>
Fri, 12 Jul 2024 17:57:45 +0000 (19:57 +0200)
committerEshel Yaron <me@eshelyaron.com>
Fri, 12 Jul 2024 17:57:45 +0000 (19:57 +0200)
lisp/emacs-lisp/easy-mmode.el

index 45e547a7f635328ba99c6e7c7074039c93db8ba1..f5a9f443f2af61edafb7ad877373270daeb36f7d 100644 (file)
@@ -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.