all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* New minor mode toggling in V24
@ 2012-01-20  0:49 Frozenlock
  2012-01-20 13:55 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Frozenlock @ 2012-01-20  0:49 UTC (permalink / raw)
  To: emacs-devel

Dear GNU Emacs developers,

I've noticed that I can no longer use the form (some-minor-mode) to
toggle a minor mode on and off in a function. The function's
documentation now says "If called from Lisp, enable the mode if ARG is
omitted or nil."

My understanding of Lisp would have led me into thinking that a mode
is on when true and off when nil. Of course, I'm sure there's a good
reason for this, such as the "toggling" behavior.

However, that a function could behave differently when called
interactively violates the principle of least astonishment.
_Especially_ for functions used as often as modes.

If only it was that...

Now to toggle a mode inside a function, I do something like this:
(some-minor-mode (when some-minor-mode-variable) -1)
Yet, some modes do not name the some-minor-mode-variable the same as
the mode itself, making the action of toggling a mode a one of a kind,
built only for this mode.

Could minor-modes function behave the same when called by a function
as they would if called interactively? I believe The toggling would be
easier to understand for everyone (at least for myself).

ARG nil --> toggle
ARG 1   --> on
ARG -1  --> off


Thank you for your time,

Christian Fortin



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-20 18:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-20  0:49 New minor mode toggling in V24 Frozenlock
2012-01-20 13:55 ` Stefan Monnier
2012-01-20 18:01   ` Frozenlock

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.