From 2a4b0da28c3d25f2eea17c9dc95f7a244bdf4535 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 1 Nov 2020 15:00:36 +0100 Subject: Make minor mode ARG work as documented * lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring): Clarify when minor modes are switched on/off when called from lisp (bug#44341). (define-minor-mode): Make calls from Lisp switch the mode on/off as documented. --- test/lisp/emacs-lisp/easy-mmode-tests.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/lisp/emacs-lisp') diff --git a/test/lisp/emacs-lisp/easy-mmode-tests.el b/test/lisp/emacs-lisp/easy-mmode-tests.el index 4d7fe9444fb..4a448200a2b 100644 --- a/test/lisp/emacs-lisp/easy-mmode-tests.el +++ b/test/lisp/emacs-lisp/easy-mmode-tests.el @@ -44,6 +44,27 @@ '(c-mode (not message-mode mail-mode) text-mode)) t)))) +(ert-deftest easy-mmode--minor-mode () + (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)))) + (provide 'easy-mmode-tests) ;;; easy-mmode-tests.el ends here -- cgit v1.2.3