[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
New minor mode toggling in V24
From: |
Frozenlock |
Subject: |
New minor mode toggling in V24 |
Date: |
Thu, 19 Jan 2012 19:49:53 -0500 |
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
- New minor mode toggling in V24,
Frozenlock <=