(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.
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.
(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)))
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.