all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@gnu.org>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: 'Dan Nicolaescu' <dann@ics.uci.edu>, emacs-devel@gnu.org
Subject: Re: turning on minor modes from hooks
Date: Sun, 30 Aug 2009 11:11:41 +0900	[thread overview]
Message-ID: <87ws4mgiea.fsf@catnip.gol.com> (raw)
In-Reply-To: <9CA8B839B73049A6A7B1AD1C4D92BFC3@us.oracle.com> (Drew Adams's message of "Sat, 29 Aug 2009 17:14:53 -0700")

"Drew Adams" <drew.adams@oracle.com> writes:
>> Stephen has long advocated that non-interactive invocation of mode
>> commands should always turn on the mode instead of toggling.
>
> So interactively a nil arg will toggle, but in Lisp a nil arg will turn it on?
> And just why is that a great idea?

Er, because it works the command work "as expected" in all contexts,
instead of in just one.

>> I agree with that:  I think the vast majority of uses in code 
>> do not use the toggling anyway, and while there probably are
>> a few uses which would be broken by such a change, I think
>> there would be far _more_ currently-incorrect uses
>
> In libraries or in user init files?

Mostly in user init files -- uses in libraries mostly won't be affected,
as they tend to explicitly specify the argument, and explicitly
set or reset the mode, not toggle it.

> The latter, maybe, at least until they
> discover that it doesn't do what they thought. That doesn't take long...

That's exactly the problem -- it _does_ take long for a user to
discover, because the default state for most modes is "off", and so
toggling _usually_ does the right thing.  Inadvertent use of the
toggling behavior tends to result in obscure and hard to locate bugs
(because it "usually" works right, and only fails in the rare case where
the mode happens to be already turned on for some reason).

>> that would be _fixed_ by such a change (where someone uses
>> (add-hook 'foo-hook 'ack-mode) not realizing that it really
>> toggles instead of turning on).
>
> "Not realizing" is the key phrase. This is not about being unable to understand,
> I think. It's about ordinary ignorance. It's about things not being the way some
> newbies expect, without reading the doc.

Yes.  Of course the doc should be good, but it's pretty clear that in
practice, it's not enough -- people don't always read the doc, or don't
read it carefully enough, or aren't experienced enough to understand all
the ramifications of what they're reading (the latter can be addressed
to some extent by careful wording, but it's almost impossible to do
reach all users).

Thus it's really really useful if we can have _both_ good docs _and_
commands that work intuitively.  Belt and braces, etc, etc.

> This is a YAGNI feature, at best, and a bug-producer and code
> complexifier, at worst.

I think you're wrong.  It will cause some bugs, but it will fix far more.

-Miles

-- 
I'm beginning to think that life is just one long Yoko Ono album; no rhyme
or reason, just a lot of incoherent shrieks and then it's over.  --Ian Wolff




  reply	other threads:[~2009-08-30  2:11 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 [this message]
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
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

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

  git send-email \
    --in-reply-to=87ws4mgiea.fsf@catnip.gol.com \
    --to=miles@gnu.org \
    --cc=dann@ics.uci.edu \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.