emacs-devel
[Top][All Lists]
Advanced

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

Re: turning on minor modes from hooks


From: Miles Bader
Subject: Re: turning on minor modes from hooks
Date: Tue, 01 Sep 2009 09:17:20 +0900

Stefan Monnier <address@hidden> 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
"or"...

> 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
interfaces.

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
constraints.

-Miles

-- 
Vote, v. The instrument and symbol of a freeman's power to make a fool of
himself and a wreck of his country.




reply via email to

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