Commit 3b7e1d5f authored by Stefan Monnier's avatar Stefan Monnier
Browse files

(define-minor-mode): A nil argument to the minor mode turns the mode ON.

parent 01f5787b
...@@ -140,6 +140,8 @@ Secret Service API requires D-Bus for communication. ...@@ -140,6 +140,8 @@ Secret Service API requires D-Bus for communication.
* Incompatible Lisp Changes in Emacs 24.1 * 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 * Lisp changes in Emacs 24.1
......
2010-04-13 Stefan Monnier <monnier@iro.umontreal.ca>
* 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 <monnier@iro.umontreal.ca> 2010-04-12 Stefan Monnier <monnier@iro.umontreal.ca>
* vc-dir.el (vc-dir-kill-line): New command. * vc-dir.el (vc-dir-kill-line): New command.
......
...@@ -222,15 +222,10 @@ With zero or negative ARG turn mode off. ...@@ -222,15 +222,10 @@ With zero or negative ARG turn mode off.
(interactive (list (or current-prefix-arg 'toggle))) (interactive (list (or current-prefix-arg 'toggle)))
(let ((,last-message (current-message))) (let ((,last-message (current-message)))
(setq ,mode (setq ,mode
(cond (if (eq arg 'toggle)
((eq arg 'toggle) (not ,mode)) (not ,mode)
(arg (> (prefix-numeric-value arg) 0)) ;; A nil argument also means ON now.
(t (> (prefix-numeric-value arg) 0)))
(if (null ,mode) t
(message
"Toggling %s off; better pass an explicit argument."
',mode)
nil))))
,@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 ,mode ',hook-on ',hook-off)) (run-hooks ',hook (if ,mode ',hook-on ',hook-off))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment