unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: dann@ics.uci.edu, rms@gnu.org, emacs-devel@gnu.org
Subject: Re: turning on minor modes from hooks
Date: Tue, 01 Sep 2009 09:17:20 +0900	[thread overview]
Message-ID: <87ljkz7c33.fsf@catnip.gol.com> (raw)
In-Reply-To: <jwvhbvn5znk.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 31 Aug 2009 19:32:29 -0400")

Stefan Monnier <monnier@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
"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	other threads:[~2009-09-01  0:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-29 21:25 turning on minor modes from hooks Dan Nicolaescu
2009-08-29 23:18 ` Miles Bader
2009-08-30  0:14   ` Drew Adams
2009-08-30  2:11     ` Miles Bader
2009-08-30  3:01       ` Drew Adams
2009-08-30  3:58         ` Miles Bader
2009-08-30  3:59     ` Stefan Monnier
2009-08-30  4:00       ` Miles Bader
2009-08-31  3:33   ` Richard Stallman
2009-08-31 14:36     ` Stefan Monnier
2009-08-31 22:15       ` Miles Bader
2009-08-31 23:32         ` Stefan Monnier
2009-09-01  0:17           ` Miles Bader [this message]
2009-09-01 12:16       ` Richard Stallman
2009-09-01 16:19         ` Stefan Monnier
2009-09-01 21:20           ` Richard Stallman
2009-09-01 23:23             ` Stefan Monnier
2009-09-03 13:47               ` Richard Stallman
2009-09-04 21:23                 ` Geoff Gole
2009-08-31 15:30     ` Daniel Colascione
2009-08-31 18:54       ` Tassilo Horn
2009-09-01 12:16         ` Richard Stallman
2009-08-31 23:43       ` Stefan Monnier
2009-09-01  2:07       ` Stephen J. Turnbull

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=87ljkz7c33.fsf@catnip.gol.com \
    --to=miles@gnu.org \
    --cc=dann@ics.uci.edu \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rms@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).