* 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.
If called from Lisp, toggle the mode if ARG is `toggle'.
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
it is disabled.")
(cond ((eq arg 'toggle)
(not ,getter))
((and (numberp arg)
- (> arg 0))
- t)
- ((eq arg nil)
- t)
+ (< arg 1))
+ nil)
(t
- nil)))
+ t)))
,@body
;; The on/off hooks are here for backward compatibility only.
(run-hooks ',hook (if ,getter ',hook-on ',hook-off))
(with-temp-buffer
(define-minor-mode test-mode "A test.")
(should (eq test-mode nil))
- (test-mode t)
- (should (eq test-mode nil))
(test-mode nil)
(should (eq test-mode t))
(test-mode -33)
(should (eq test-mode nil))
(test-mode 33)
(should (eq test-mode t))
- (test-mode 0)
- (should (eq test-mode nil))
- (test-mode 'toggle)
- (should (eq test-mode t))
(test-mode 'toggle)
(should (eq test-mode nil))
- (test-mode "what")
- (should (eq test-mode nil))))
+ (test-mode 'toggle)
+ (should (eq test-mode t))))
(provide 'easy-mmode-tests)