unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Cc: Emacs-Devel <emacs-devel@gnu.org>
Subject: Re: doc of defining minor modes
Date: Thu, 18 May 2006 19:07:13 +0200	[thread overview]
Message-ID: <85iro3gt32.fsf@lola.goethe.zz> (raw)
In-Reply-To: <MEEKKIABFKKDFJMPIOEBIEIHDBAA.drew.adams@oracle.com> (Drew Adams's message of "Thu, 18 May 2006 09:38:05 -0700")

"Drew Adams" <drew.adams@oracle.com> writes:

> Sometime in the last year, this text was added to Elisp info node Defining
> Minor Modes:
>
>    The initial value must be `nil' except in cases where (1) the mode
>    is preloaded in Emacs, or (2) it is painless for loading to enable the
>    mode even though the user did not request it.  For instance, if the
>    mode has no effect unless something else is enabled, and will always be
>    loaded by that time, enabling it by default is harmless.  But these are
>    unusual circumstances.  Normally, the initial value must be `nil'.
>
> FWIW, I do not agree. It is sometimes useful to enable a minor mode
> upon load, and there is nothing wrong with that for normal
> (i.e. respectful) minor modes. If I'm missing something here, let me
> know - what's the harm (vs "harmless")?

Customize might load a file just because a variable has been
customized from it.

> Third, I don't see why we are stating this guideline /
> recommendation / prescription. Users can always set the mode value
> to nil in their init files, which, for a mode that always toggles
> based on changes to this variable (which is the normal, recommended
> case) will inhibit mode enabling upon load.

Uh what?  Why should that happen?

> That was the spin used previously in this doc, I believe, and I
> think it is the correct recommendation. We should say something like
> this (the idea, if not the wording):
>
>   Unless the mode automatically toggles upon changes to the mode
>   variable, do not enable the mode upon load. Why? Because users
>   have no way to inhibit enabling in that case.

How do you suppose to inhibit enabling when the mode "automatically
toggles upon changes" in this case?

> That is the only case where it is important not to enable the mode
> upon load, AFAIK. The part about modes that don't respect their
> variable is missing in the current guideline - it speaks of
> "painless" and "harmless", but nowhere does it explain what the pain
> or harm is.

Files may even get autoloaded when going through a menu.

> I personally think that perhaps most normal (respectful) minor modes
> should be enabled upon load, but I wouldn't go so far as to proclaim
> that in the doc. Enabling the mode by default upon load
> (i.e. enabling unless the variable is nil) is "harmless", unless I'm
> missing something. If I am missing something, then maybe that
> something needs to be added to the doc.

Stuff connected with autoloads and customization groups triggers at
unusual moments.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

  parent reply	other threads:[~2006-05-18 17:07 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-18 16:38 doc of defining minor modes Drew Adams
2006-05-18 17:00 ` Andreas Schwab
2006-05-18 17:22   ` Drew Adams
2006-05-18 17:47     ` David Kastrup
2006-05-18 17:55       ` Drew Adams
2006-05-18 18:03         ` David Kastrup
2006-05-18 18:10           ` Drew Adams
2006-05-18 18:59             ` Stefan Monnier
2006-05-18 22:12               ` Drew Adams
2006-05-19  3:21                 ` Stefan Monnier
2006-05-18 20:38             ` David Kastrup
2006-05-18 22:11               ` Drew Adams
2006-05-18 22:36                 ` David Kastrup
2006-05-19  0:01                   ` Drew Adams
2006-05-19  0:25                     ` David Kastrup
2006-05-19  1:44                       ` Drew Adams
2006-05-19  6:20                         ` David Kastrup
2006-05-19 17:39                           ` Drew Adams
2006-05-19 15:59                         ` Drew Adams
2006-05-19 16:29                           ` David Kastrup
2006-05-19 17:45                             ` Drew Adams
2006-05-19 18:43                               ` Andreas Schwab
2006-05-19 16:43                           ` Stefan Monnier
2006-05-19 17:43                             ` Drew Adams
2006-05-19 17:52                               ` David Kastrup
2006-05-19 18:28                               ` Stefan Monnier
2006-05-19  1:49             ` Miles Bader
2006-05-18 17:07 ` David Kastrup [this message]
2006-05-18 17:55   ` Drew Adams
2006-05-19  2:05 ` Richard Stallman
2006-05-19 15:59   ` Drew Adams
2006-05-19 16:40     ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85iro3gt32.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).