bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: bug#4102: 23.1.50; recentf-mode nil but toggles


From: Xah Lee
Subject: Re: bug#4102: 23.1.50; recentf-mode nil but toggles
Date: Wed, 12 Aug 2009 12:33:43 -0700 (PDT)
User-agent: G2/1.0

On Aug 11, 9:05 pm, Kevin Rodgers <address@hidden> wrote:
> Xah Lee wrote:
> >>> With prefix argument arg, turn on if positive, otherwise off.
>
> >> It's not clear whether nil is positive or negative.
>
> It seems clear to me that nil is not positive, so the "otherwise"
> condition holds.
>
> > Thanks. That's interesting.
>
> > Can the doc adds a warning like:
>
> > The argument should be a integer. Do not use t or nil.
>
> Do not use `supercalifragilisticexpialidocious' either.
>
> How about: Use nil to toggle the mode on or off.

hi Kevin,

i think that's a bit unreasonable.

the use of 1 and 0 for on and off for minor mode function, is not
exactly intuitive, because in elisp, although the lang does not have
boolean datatype, but by convention, t is for true, and nil for false,
and technically, nil is false, everything else is true.

So, minor modes using 1 and 0 is kinda unclean, un-elegant, or counter
intuitive. The reason it does that, is of course due to the fact that
emacs commands thru interactive use by convention takes universal-
argument, and universal-argument only take integer as arguments, not
some string or lisp symbol. So, there's the justification for 1 and 0.

However, in lisp code, it is also reasonable to expect that nil would
be equivalent to 0, as by lisp convention. This logic may not look
logical to you, but i think is reasonable alternative expectation.
When a mode gets its arg thru interactive use, the arg is expected to
be integers by the way emacs do things interactively, and thus
positive int is considered true or turn on, negative is considered
false/off. But in lisp code, besides 1 and 0, you can also specify t
and nil as usual by lisp convention. This could easily be considered
as a alternative design decision.

(adding to the mess is that some command will change behavior as kinda
on/off or true/false depending on whether universal-argument is called
regardless of its argument)

all things considered, i think it is reasonable that a average lisp
coder will be confused by this. Thus my recommendation that a warning
or notes be added to the doc. Is there somewhere in elisp manual that
explicitly explains/warns that commands that turn minor mode on/off
stick to 1 and 0 and consider t and nil not acceptable argument?

PS i didn't receive your previous email, i just happened to see your
reply in google group. I'm not much in the emacs dev community so i'm
not regular gnu emacs bug database reader... please cc me too on this.
thanks.

  Xah
∑ http://xahlee.org/

reply via email to

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