summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/easy-mmode.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-11-07 16:21:36 +0100
committerAndrea Corallo <akrl@sdf.org>2020-11-07 16:21:36 +0100
commit75e8ee728fdda91a9eca7f3db24b639e8036f7e4 (patch)
treeef7381399099137d44aba924de40d1fb8834331d /lisp/emacs-lisp/easy-mmode.el
parent6c271ffaa808c602e177db4bd2297ff81112147e (diff)
parente8f5657bc7f6e0e45f70e4849736c6e87d44a1ac (diff)
downloademacs-75e8ee728fdda91a9eca7f3db24b639e8036f7e4.tar.gz
emacs-75e8ee728fdda91a9eca7f3db24b639e8036f7e4.tar.bz2
emacs-75e8ee728fdda91a9eca7f3db24b639e8036f7e4.zip
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'lisp/emacs-lisp/easy-mmode.el')
-rw-r--r--lisp/emacs-lisp/easy-mmode.el26
1 files changed, 17 insertions, 9 deletions
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index a707d204f8b..261f2508af7 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -84,10 +84,13 @@ replacing its case-insensitive matches with the literal string in LIGHTER."
(defconst easy-mmode--arg-docstring
"
-If called interactively, enable %s if ARG is positive, and
-disable it if ARG is zero or negative. If called from Lisp,
-also enable the mode if ARG is omitted or nil, and toggle it
-if ARG is `toggle'; disable the mode otherwise.
+If called interactively, toggle `%s'. 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.
The mode's hook is called both when the mode is enabled and when
it is disabled.")
@@ -301,13 +304,18 @@ or call the function `%s'."))))
,(easy-mmode--mode-docstring doc pretty-name keymap-sym)
;; Use `toggle' rather than (if ,mode 0 1) so that using
;; repeat-command still does the toggling correctly.
- (interactive (list (or current-prefix-arg 'toggle)))
+ (interactive (list (if current-prefix-arg
+ (prefix-numeric-value current-prefix-arg)
+ 'toggle)))
(let ((,last-message (current-message)))
(,@setter
- (if (eq arg 'toggle)
- (not ,getter)
- ;; A nil argument also means ON now.
- (> (prefix-numeric-value arg) 0)))
+ (cond ((eq arg 'toggle)
+ (not ,getter))
+ ((and (numberp arg)
+ (< arg 1))
+ nil)
+ (t
+ t)))
,@body
;; The on/off hooks are here for backward compatibility only.
(run-hooks ',hook (if ,getter ',hook-on ',hook-off))