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: Stefan Monnier
Subject: Re: turning on minor modes from hooks
Date: Tue, 01 Sep 2009 19:23:56 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

> One design that occurs to me is (foo-mode) turns it on, (foo-mode t)
> turns it on, (foo-mode nil) turns it off, and the way you toggle is
> (foo-mode (not foo-mode)).

(foo-mode 'toggle) toggles it.
I'm not necessarily opposed to (foo-mode (not foo-mode)) but it can't be
used in the interactive spec, because we want the command-history to say
"toogle" rather than "turn on" or "turn off", in case the user wants to
repeat it.

> Another is (foo-mode) toggles,

That's what we have and it sucks, because it means that

  (add-hook 'bar-hook foo-mode)

doesn't do what the user usually intends to do.  Same thing with
-*- mode: foo -*-.  That's why (foo-mode) needs to unconditionally turn
the mode on.

> The current convention for interactive calls seems clear and natural
> so I think it should be preserved, whatever we do with calls from Lisp.

Agreed.


        Stefan




reply via email to

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