all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: emacs-devel@gnu.org
Subject: Re: questions about define-minor-mode
Date: Thu, 08 Apr 2010 22:16:40 -0400	[thread overview]
Message-ID: <jwvtyrl8jig.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <4576E95FD8124CC1B0C77C7DECF45EE7@us.oracle.com> (Drew Adams's message of "Thu, 8 Apr 2010 08:51:59 -0700")

> 1. `define-minor-mode' defines a defcustom if the mode is declared
> global, but it does not otherwise.

> Why not? I'm sure there is a good reason, but it's not clear to me.
> Why shouldn't a user be able to customize the (default) value for
> a non-global minor mode?

The reason is that such a "global default" can not always be changed
easily and correctly in a way that doesn't risk confusing users.
I.e. it would only make sense if/when we can provide a meaningful
interface such as "always activate it in this/that situation".
Until then, the programmer will have to provide its own defcustom for
those cases where it makes sense.

> 3. The explanation of "initial value must (!) be `nil'" is not clear
> to me at all.  I don't understand either the "exceptional" conditions
> under which non-nil is permitted (!) or the reasoning behind
> this rule.

The initial value should *describe* (i.e. not control) the normal state
in the case where the minor mode function is not called.

For minor modes where the function does not do anything (i.e. all the
minor mode's state is kept in the boolean variable), the different
between controlling and describing is irrelevant.  But in the general
case it's important since otherwise loading the file would require Emacs
to run the minor-mode function to make sure the state is consistent
with the minor mode variable.


        Stefan




  reply	other threads:[~2010-04-09  2:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-08 15:51 questions about define-minor-mode Drew Adams
2010-04-09  2:16 ` Stefan Monnier [this message]
2010-04-09  3:21 ` Kevin Rodgers

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=jwvtyrl8jig.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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.