[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: turning on minor modes from hooks
From: |
Stefan Monnier |
Subject: |
Re: turning on minor modes from hooks |
Date: |
Sat, 29 Aug 2009 23:59:09 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
>> Stephen has long advocated that non-interactive invocation of mode
^^^^^^^
Was that meant to be me?
>> commands should always turn on the mode instead of toggling.
> So interactively a nil arg will toggle, but in Lisp a nil arg will
> turn it on? And just why is that a great idea?
No: currently, minor modes defined with `define-minor-mode' will never
receive nil when invoked interactively. They'll either get a prefix
arg, or the symbol `toggle'.
The patch below would change define-minor-mode as suggested.
Stefan
--- lisp/emacs-lisp/easy-mmode.el 2009-01-05 10:18:22 +0000
+++ lisp/emacs-lisp/easy-mmode.el 2009-07-24 02:11:35 +0000
@@ -225,12 +225,7 @@
(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))))
+ (t)))
,@body
;; The on/off hooks are here for backward compatibility only.
(run-hooks ',hook (if ,mode ',hook-on ',hook-off))
Re: turning on minor modes from hooks, Richard Stallman, 2009/08/30
Re: turning on minor modes from hooks, Daniel Colascione, 2009/08/31
Re: turning on minor modes from hooks, Tassilo Horn, 2009/08/31
Re: turning on minor modes from hooks, Stefan Monnier, 2009/08/31
Re: turning on minor modes from hooks, Stephen J. Turnbull, 2009/08/31