aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2020-11-02 10:17:08 +0100
committerLars Ingebrigtsen2020-11-02 10:17:08 +0100
commit5cea77af41b59ba6f6386264812c36ec31ba2efc (patch)
tree3288c47d9c7b92bfd203c76c9c76af4bd5419230
parent5ab5504def63ebdfba08169f24a5829353bff137 (diff)
downloademacs-5cea77af41b59ba6f6386264812c36ec31ba2efc.tar.gz
emacs-5cea77af41b59ba6f6386264812c36ec31ba2efc.zip
Partially revert previous define-minor-mode change
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring): Only document the values we want to support, not the ones we actually support. (define-minor-mode): Partially revert to previous behaviour.
-rw-r--r--lisp/emacs-lisp/easy-mmode.el10
-rw-r--r--test/lisp/emacs-lisp/easy-mmode-tests.el10
2 files changed, 6 insertions, 14 deletions
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 77f10e61c6c..261f2508af7 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -90,7 +90,7 @@ the mode.
90 90
91If called from Lisp, toggle the mode if ARG is `toggle'. 91If called from Lisp, toggle the mode if ARG is `toggle'.
92Enable the mode if ARG is nil, omitted, or is a positive number. 92Enable the mode if ARG is nil, omitted, or is a positive number.
93All other values will disable the mode. 93Disable the mode if ARG is a negative number.
94 94
95The mode's hook is called both when the mode is enabled and when 95The mode's hook is called both when the mode is enabled and when
96it is disabled.") 96it is disabled.")
@@ -312,12 +312,10 @@ or call the function `%s'."))))
312 (cond ((eq arg 'toggle) 312 (cond ((eq arg 'toggle)
313 (not ,getter)) 313 (not ,getter))
314 ((and (numberp arg) 314 ((and (numberp arg)
315 (> arg 0)) 315 (< arg 1))
316 t) 316 nil)
317 ((eq arg nil)
318 t)
319 (t 317 (t
320 nil))) 318 t)))
321 ,@body 319 ,@body
322 ;; The on/off hooks are here for backward compatibility only. 320 ;; The on/off hooks are here for backward compatibility only.
323 (run-hooks ',hook (if ,getter ',hook-on ',hook-off)) 321 (run-hooks ',hook (if ,getter ',hook-on ',hook-off))
diff --git a/test/lisp/emacs-lisp/easy-mmode-tests.el b/test/lisp/emacs-lisp/easy-mmode-tests.el
index 4a448200a2b..c05379e4415 100644
--- a/test/lisp/emacs-lisp/easy-mmode-tests.el
+++ b/test/lisp/emacs-lisp/easy-mmode-tests.el
@@ -48,22 +48,16 @@
48 (with-temp-buffer 48 (with-temp-buffer
49 (define-minor-mode test-mode "A test.") 49 (define-minor-mode test-mode "A test.")
50 (should (eq test-mode nil)) 50 (should (eq test-mode nil))
51 (test-mode t)
52 (should (eq test-mode nil))
53 (test-mode nil) 51 (test-mode nil)
54 (should (eq test-mode t)) 52 (should (eq test-mode t))
55 (test-mode -33) 53 (test-mode -33)
56 (should (eq test-mode nil)) 54 (should (eq test-mode nil))
57 (test-mode 33) 55 (test-mode 33)
58 (should (eq test-mode t)) 56 (should (eq test-mode t))
59 (test-mode 0)
60 (should (eq test-mode nil))
61 (test-mode 'toggle)
62 (should (eq test-mode t))
63 (test-mode 'toggle) 57 (test-mode 'toggle)
64 (should (eq test-mode nil)) 58 (should (eq test-mode nil))
65 (test-mode "what") 59 (test-mode 'toggle)
66 (should (eq test-mode nil)))) 60 (should (eq test-mode t))))
67 61
68(provide 'easy-mmode-tests) 62(provide 'easy-mmode-tests)
69 63