emacs-devel
[Top][All Lists]
Advanced

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

Re: void variable


From: Luc Teirlinck
Subject: Re: void variable
Date: Wed, 28 Jul 2004 21:31:47 -0500 (CDT)

Richard Stallman wrote:

       2. Manual explain the same a bit more elaborate and direct people to 
       autoload relevant variables to avoid the pitfall.

   That could mean too many things, so I have no opinion.

I have committed my _original_ patches for def{var,const,custom}.
In as far as the Elisp manual is concerned, what about the following patch?

===File ~/variables-diff====================================
*** variables.texi      23 Jun 2004 10:23:55 -0500      1.52
--- variables.texi      28 Jul 2004 21:15:39 -0500      
***************
*** 1,6 ****
  @c -*-texinfo-*-
  @c This is part of the GNU Emacs Lisp Reference Manual.
! @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999,
  @c 2000, 2003, 2004
  @c   Free Software Foundation, Inc.
  @c See the file elisp.texi for copying conditions.
--- 1,6 ----
  @c -*-texinfo-*-
  @c This is part of the GNU Emacs Lisp Reference Manual.
! @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2004,
  @c 2000, 2003, 2004
  @c   Free Software Foundation, Inc.
  @c See the file elisp.texi for copying conditions.
***************
*** 588,593 ****
--- 588,606 ----
  a file, where normally no local binding is in effect, and make sure to
  load the file before making a local binding for the variable.
  
+ If you make a local binding for a variable defined with @code{defvar}
+ or @code{defcustom} in another non-preloaded file, and if anything in
+ the scope of the binding loads that file, for instance through
+ autoloading, then this may fail to properly initialize the variable.
+ If the @code{defvar} or @code{defcustom} itself is autoloaded through
+ a magic comment (@pxref{Autoload}), then there is nothing to worry
+ about: it is already initialized.  Otherwise, there are two ways to
+ prevent trouble.  You can precede the @code{defvar} or
+ @code{defcustom} with a magic comment, or you can @code{require} the
+ file before making the binding (@pxref{Named Features}).  The same
+ applies to variables defined with @code{defconst}, but you should
+ normally not bind such variables anyway.
+ 
  @node Tips for Defining
  @section Tips for Defining Variables Robustly
  
============================================================




reply via email to

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