emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r99887: (define-minor-mode): A nil ar


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99887: (define-minor-mode): A nil argument to the minor mode turns the mode ON.
Date: Mon, 12 Apr 2010 21:03:04 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99887
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2010-04-12 21:03:04 -0400
message:
  (define-minor-mode): A nil argument to the minor mode turns the mode ON.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/emacs-lisp/easy-mmode.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2010-04-11 18:25:09 +0000
+++ b/etc/NEWS  2010-04-13 01:03:04 +0000
@@ -140,6 +140,8 @@
 
 * Incompatible Lisp Changes in Emacs 24.1
 
+** Passing a nil argument to a minor mode function now turns the mode
+   ON unconditionally.
 
 * Lisp changes in Emacs 24.1
 

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-04-12 19:14:16 +0000
+++ b/lisp/ChangeLog    2010-04-13 01:03:04 +0000
@@ -1,3 +1,8 @@
+2010-04-13  Stefan Monnier  <address@hidden>
+
+       * emacs-lisp/easy-mmode.el (define-minor-mode): Passing a nil argument
+       to the minor mode function now turns the mode ON unconditionally.
+
 2010-04-12  Stefan Monnier  <address@hidden>
 
        * vc-dir.el (vc-dir-kill-line): New command.

=== modified file 'lisp/emacs-lisp/easy-mmode.el'
--- a/lisp/emacs-lisp/easy-mmode.el     2010-01-13 08:35:10 +0000
+++ b/lisp/emacs-lisp/easy-mmode.el     2010-04-13 01:03:04 +0000
@@ -222,15 +222,10 @@
         (interactive (list (or current-prefix-arg 'toggle)))
         (let ((,last-message (current-message)))
            (setq ,mode
-                 (cond
-                  ((eq arg 'toggle) (not ,mode))
-                  (arg (> (prefix-numeric-value arg) 0))
-                  (t
-                   (if (null ,mode) t
-                     (message
-                      "Toggling %s off; better pass an explicit argument."
-                      ',mode)
-                     nil))))
+                 (if (eq arg 'toggle)
+                     (not ,mode)
+                   ;; A nil argument also means ON now.
+                   (> (prefix-numeric-value arg) 0)))
            ,@body
            ;; The on/off hooks are here for backward compatibility only.
            (run-hooks ',hook (if ,mode ',hook-on ',hook-off))


reply via email to

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