1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-09 15:50:40 -08:00

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.
This commit is contained in:
Lars Ingebrigtsen 2020-11-02 10:17:08 +01:00
parent 5ab5504def
commit 5cea77af41
2 changed files with 6 additions and 14 deletions

View file

@ -90,7 +90,7 @@ the mode.
If called from Lisp, toggle the mode if ARG is `toggle'. If called from Lisp, toggle the mode if ARG is `toggle'.
Enable the mode if ARG is nil, omitted, or is a positive number. Enable the mode if ARG is nil, omitted, or is a positive number.
All other values will disable the mode. Disable the mode if ARG is a negative number.
The mode's hook is called both when the mode is enabled and when The mode's hook is called both when the mode is enabled and when
it is disabled.") it is disabled.")
@ -312,12 +312,10 @@ or call the function `%s'."))))
(cond ((eq arg 'toggle) (cond ((eq arg 'toggle)
(not ,getter)) (not ,getter))
((and (numberp arg) ((and (numberp arg)
(> arg 0)) (< arg 1))
t) nil)
((eq arg nil)
t)
(t (t
nil))) t)))
,@body ,@body
;; The on/off hooks are here for backward compatibility only. ;; The on/off hooks are here for backward compatibility only.
(run-hooks ',hook (if ,getter ',hook-on ',hook-off)) (run-hooks ',hook (if ,getter ',hook-on ',hook-off))

View file

@ -48,22 +48,16 @@
(with-temp-buffer (with-temp-buffer
(define-minor-mode test-mode "A test.") (define-minor-mode test-mode "A test.")
(should (eq test-mode nil)) (should (eq test-mode nil))
(test-mode t)
(should (eq test-mode nil))
(test-mode nil) (test-mode nil)
(should (eq test-mode t)) (should (eq test-mode t))
(test-mode -33) (test-mode -33)
(should (eq test-mode nil)) (should (eq test-mode nil))
(test-mode 33) (test-mode 33)
(should (eq test-mode t)) (should (eq test-mode t))
(test-mode 0)
(should (eq test-mode nil))
(test-mode 'toggle)
(should (eq test-mode t))
(test-mode 'toggle) (test-mode 'toggle)
(should (eq test-mode nil)) (should (eq test-mode nil))
(test-mode "what") (test-mode 'toggle)
(should (eq test-mode nil)))) (should (eq test-mode t))))
(provide 'easy-mmode-tests) (provide 'easy-mmode-tests)