Re: turning on minor modes from hooks
Miles Bader <miles <at> gnu.org>
2009-09-01 00:17:20 GMT
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>>>> A call with no arguments, as in (auto-save-mode), naturally ought to
>>>> toggle the mode or turn it on.
>>> Care to explain why?
>> Note that he said "or turn it on"; I think the point was to distinguish
>> those possibilities from "unconditionally turn it off".
> Toggling is just wrong for it.
Right, but the second possibility, "turn it on" (and I interpreted that
to mean "unconditionally turn it on"), is right, and he _did_ say
> I understand why it's like this right now, but from an Lisp point of
> view, it's just not the right choice, and there's no need here to
> distinguish a nil arg from the absence of an arg.
I agree that toggling is wrong for the elisp interface, but I disagree
with the rest of that -- as a programmer, (foo) and (foo nil) _do_ look
like entirely different things; the fact that they're conflated in elisp
seems like an implementation detail, not a design choice; it's generally
harmless, but on occasion can result in annoyingly counter-intuitive
In the case of mode functions, ideally I _could_ use (foo-mode) _or_
(foo-mode t) to turn on foo mode, and (foo-mode nil) to turn it off.
Those usages seem like the natural ones to me, given no implementation