unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: p.galbraith@globetrotter.net, wohler@newt.com, emacs-devel@gnu.org
Subject: Re: custom-set-variables fails to set variable
Date: Fri, 11 Nov 2005 22:05:29 -0600 (CST)	[thread overview]
Message-ID: <200511120405.jAC45Tl25795@raven.dms.auburn.edu> (raw)
In-Reply-To: <E1EamDj-0002Ne-FD@fencepost.gnu.org> (rms@gnu.org)

       Why does define-minor-mode need to defvar the mode hook?  There is no
       need to defvar hooks.  `add-hook' can perfectly handle unbound hook
       variables.  I propose that we revert this change in
       define-derived-mode.

   I agree, if we can't find a better solution.

   Another possible solution is to autoload the defcustoms
   for these particular variables.  Would that work?

Yes, but this is inevitably going to be forgotten for some defcustoms.

   A more automatic solution could be: define-derived-mode
   could automatically produce an autoload definition
   of the defvar.  That would solve the problem, right?

Yes, but both the manual and the automated solutions have the
potential for problems.  Somebody supplying a defcustom may want a
tailor-made docstring for the defcustom, mentioning typical uses for
the hook and the defvar's docstring could overwrite that.  In general,
it does not seem very good to have two competing different definitions
for a variable.  This solution might also unnecessarily bloat loaddefs.

Remember that all of this came about because the mode's docstring
contains:

    Entry to this mode calls the value of `lisp-mode-hook'
    if that value is non-nil.

And `C-h v' on lisp-mode-hook did not work.

Maybe we could just change that to:

    Entry to this mode calls the value of `lisp-mode-hook'
    if that value is bound and non-nil.  `add-hook' automatically
    binds a hook variable if it was previously unbound.

That would also help people understand why `C-h v foo-hook' does not
always work for hooks.  Many hooks that are not mode hooks have no
defvar.

Sincerely,

Luc.

  reply	other threads:[~2005-11-12  4:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <11859.1131656026@olgas.newt.com>
     [not found] ` <87lkzwxduk.fsf@olgas.newt.com>
     [not found]   ` <200511110043.jAB0hhc17895@raven.dms.auburn.edu>
2005-11-12  3:38     ` custom-set-variables fails to set variable Richard M. Stallman
2005-11-12  4:05       ` Luc Teirlinck [this message]
2005-11-12  4:49         ` Luc Teirlinck
2005-11-12 21:19         ` Juri Linkov
2005-11-12  4:41       ` Luc Teirlinck
2005-11-12 21:21         ` Richard M. Stallman
2005-11-12 23:36           ` Luc Teirlinck
2005-11-14  4:55             ` Richard M. Stallman

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=200511120405.jAC45Tl25795@raven.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    --cc=emacs-devel@gnu.org \
    --cc=p.galbraith@globetrotter.net \
    --cc=wohler@newt.com \
    /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).