unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Xah Lee <xahlee@gmail.com>
To: bug-gnu-emacs@gnu.org
Subject: Re: bug#4102: 23.1.50; recentf-mode nil but toggles
Date: Wed, 12 Aug 2009 12:33:43 -0700 (PDT)	[thread overview]
Message-ID: <26d7a64b-c393-42b9-bacf-8a9e6c62eadd@f20g2000prn.googlegroups.com> (raw)
In-Reply-To: mailman.4441.1250051225.2239.bug-gnu-emacs@gnu.org

On Aug 11, 9:05 pm, Kevin Rodgers <kevin.d.rodg...@gmail.com> 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/

  parent reply	other threads:[~2009-08-12 19:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-10  8:06 bug#4102: 23.1.50; recentf-mode nil but toggles Xah Lee
2009-08-10 16:40 ` Stefan Monnier
2009-08-11  2:01   ` Xah Lee
2009-08-12  4:05     ` Kevin Rodgers
2009-08-13 17:36       ` Stefan Monnier
     [not found]     ` <mailman.4441.1250051225.2239.bug-gnu-emacs@gnu.org>
2009-08-12 19:33       ` Xah Lee [this message]
2009-08-13  4:15         ` Drew Adams
2009-08-13  4:53           ` Xah Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26d7a64b-c393-42b9-bacf-8a9e6c62eadd@f20g2000prn.googlegroups.com \
    --to=xahlee@gmail.com \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).