emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5cea77a: Partially revert previous define-minor-mode change


From: Lars Ingebrigtsen
Subject: master 5cea77a: Partially revert previous define-minor-mode change
Date: Mon, 2 Nov 2020 04:17:20 -0500 (EST)

branch: master
commit 5cea77af41b59ba6f6386264812c36ec31ba2efc
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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.
---
 lisp/emacs-lisp/easy-mmode.el            | 10 ++++------
 test/lisp/emacs-lisp/easy-mmode-tests.el | 10 ++--------
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 77f10e6..261f250 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -90,7 +90,7 @@ 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.
-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.")
@@ -312,12 +312,10 @@ or call the function `%s'."))))
             (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))
diff --git a/test/lisp/emacs-lisp/easy-mmode-tests.el 
b/test/lisp/emacs-lisp/easy-mmode-tests.el
index 4a44820..c05379e 100644
--- a/test/lisp/emacs-lisp/easy-mmode-tests.el
+++ b/test/lisp/emacs-lisp/easy-mmode-tests.el
@@ -48,22 +48,16 @@
   (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)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]