summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/easy-mmode.el
diff options
context:
space:
mode:
authorYuuki Harano <masm+github@masm11.me>2021-07-04 22:37:03 +0900
committerYuuki Harano <masm+github@masm11.me>2021-07-04 22:37:03 +0900
commit492a0ae5927eda83b65dd08d3e1655a62fc2c43d (patch)
tree8bb6a39483236c3a4574c93b37b0a81b8f639bb0 /lisp/emacs-lisp/easy-mmode.el
parent01b0a909b5ca858a09484821cc866127652f4153 (diff)
parent2f2afa0b310bbce43a8703f5467b2638082abdd9 (diff)
downloademacs-492a0ae5927eda83b65dd08d3e1655a62fc2c43d.tar.gz
emacs-492a0ae5927eda83b65dd08d3e1655a62fc2c43d.tar.bz2
emacs-492a0ae5927eda83b65dd08d3e1655a62fc2c43d.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'lisp/emacs-lisp/easy-mmode.el')
-rw-r--r--lisp/emacs-lisp/easy-mmode.el18
1 files changed, 12 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 0a6d4ec504e..3a00fdb454d 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -84,18 +84,22 @@ replacing its case-insensitive matches with the literal string in LIGHTER."
(defconst easy-mmode--arg-docstring
"
-If called interactively, toggle `%s'. If the prefix argument is
-positive, enable the mode, and if it is zero or negative, disable
-the mode.
+This is a minor 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'.
Enable the mode if ARG is nil, omitted, or is a positive number.
Disable the mode if ARG is a negative number.
+To check whether the minor mode is enabled in the current buffer,
+evaluate `%S'.
+
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)
+(defun easy-mmode--mode-docstring (doc mode-pretty-name keymap-sym
+ getter)
(let ((doc (or doc (format "Toggle %s on or off.
\\{%s}" mode-pretty-name keymap-sym))))
@@ -104,7 +108,8 @@ it is disabled.")
(let* ((fill-prefix nil)
(docs-fc (bound-and-true-p emacs-lisp-docstring-fill-column))
(fill-column (if (integerp docs-fc) docs-fc 65))
- (argdoc (format easy-mmode--arg-docstring mode-pretty-name))
+ (argdoc (format easy-mmode--arg-docstring mode-pretty-name
+ getter))
(filled (if (fboundp 'fill-region)
(with-temp-buffer
(insert argdoc)
@@ -308,7 +313,8 @@ or call the function `%s'."))))
,(funcall
warnwrap
`(defun ,modefun (&optional arg ,@extra-args)
- ,(easy-mmode--mode-docstring doc pretty-name keymap-sym)
+ ,(easy-mmode--mode-docstring doc pretty-name keymap-sym
+ getter)
,(when interactive
;; Use `toggle' rather than (if ,mode 0 1) so that using
;; repeat-command still does the toggling correctly.