emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: obsolete comment in tool-bar.el


From: Luc Teirlinck
Subject: Re: obsolete comment in tool-bar.el
Date: Fri, 15 Jul 2005 08:53:22 -0500 (CDT)

Stefan Monnier wrote:

   AFAIK, the motivation was also for some other cases where the user may
   somehow setq the variable before loading the file.  IIRC this setq may
   actually be done by Custom (at a time where it doesn't yet know that the var
   have a :setter).

The user should not set a minor mode variable directly unless setting
the variable is all that is needed to enable the mode, in which case
there is no need to call the function if the variable is already set.
The same applies to Custom.  Moreover, if it is done before loading
the file, it is done before the define-minor-mode.

   But this is non-obvious, so it's ugly.

In Elisp, if you call a function before it is defined, you get an
error.  If you reference a variable before it is defined, you get a
compiler warning, unless you use a compiler defvar.  That is true in
particular for :set functions if the defcustom is not produced by
define-minor-mode.  Why should defcustoms defined by define-minor-mode
be the lone exception?  I do not believe that having to define
functions and variables before using them is that horrible, but if it
is, then should not changes in the way files are loaded or compiled be
implemented, instead of this define-minor-mode only kludge?

   Also often those functions use the
   variable, so to shut up the byte-compiler you need to pre-declare the
   variable.

That is what compiler defvars are for.  Compiler defvars do not have
the confusing negative side effects that eval-after-load has.

   Miles complained loudly (in the form of comments, some of which
   may still be in the current elisp code ;-)

These comments make no sense.

Sincerely,

Luc.
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]