all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Frozenlock <frozenlock@gmail.com>
To: emacs-devel@gnu.org
Subject: New minor mode toggling in V24
Date: Thu, 19 Jan 2012 19:49:53 -0500	[thread overview]
Message-ID: <CACjB3duCXf9Ykr59igbnNKD9aY3Mc2bELnU6XEF886RCe8-ixQ@mail.gmail.com> (raw)

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



             reply	other threads:[~2012-01-20  0:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-20  0:49 Frozenlock [this message]
2012-01-20 13:55 ` New minor mode toggling in V24 Stefan Monnier
2012-01-20 18:01   ` Frozenlock

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=CACjB3duCXf9Ykr59igbnNKD9aY3Mc2bELnU6XEF886RCe8-ixQ@mail.gmail.com \
    --to=frozenlock@gmail.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.