]> code.delx.au - gnu-emacs/blobdiff - lispref/variables.texi
(Standard Hooks): Most minor modes have mode hooks too.
[gnu-emacs] / lispref / variables.texi
index bbe7358b5d7f3764feb22c5068177b435950d431..49a8f0d7a2633278d9df34638ec652e130863e31 100644 (file)
@@ -1,6 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000
+@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.
 @setfilename ../info/variables
@@ -260,8 +261,8 @@ These kinds of bindings work somewhat like ordinary local bindings, but
 they are localized depending on ``where'' you are in Emacs, rather than
 localized in time.
 
-@anchor{Definition of max-specpdl-size}
 @defvar max-specpdl-size
+@anchor{Definition of max-specpdl-size}
 @cindex variable limit error
 @cindex evaluation error
 @cindex infinite recursion
@@ -1335,6 +1336,12 @@ This returns @code{t} if @var{variable} is buffer-local in buffer
 @code{nil}.
 @end defun
 
+@defun local-variable-if-set-p variable &optional buffer
+This returns @code{t} if @var{variable} will become buffer-local in
+buffer @var{buffer} (which defaults to the current buffer) if it is
+set there.
+@end defun
+
 @defun buffer-local-value variable buffer
 This function returns the buffer-local binding of @var{variable} (a
 symbol) in buffer @var{buffer}.  If @var{variable} does not have a
@@ -1422,8 +1429,11 @@ variables that major modes set should not be marked permanent.
 The function @code{kill-all-local-variables} runs this normal hook
 before it does anything else.  This gives major modes a way to arrange
 for something special to be done if the user switches to a different
-major mode.  For best results, make this variable buffer-local, so that
-it will disappear after doing its job and will not interfere with the
+major mode.  It is also useful for buffer-specific minor modes
+that should be forgotten if the user changes the major mode.
+
+For best results, make this variable buffer-local, so that it will
+disappear after doing its job and will not interfere with the
 subsequent major mode.  @xref{Hooks}.
 @end defvar
 
@@ -1704,10 +1714,40 @@ of the variable at the end of the chain of aliases.
 This function returns @var{base-var}.
 @end defun
 
+Variables aliases are often used prior to replacing an old name for a variable
+with a new name. To allow some time for existing code to adapt to this change,
+@code{make-obsolete-variable} declares that the old name is obsolete and
+therefore that it may be removed at some stage in the future.
+
+@defmac make-obsolete-variable variable new &optional when
+This macro makes the byte-compiler warn that symbol @var{variable} is
+obsolete and that symbol @var{new} should be used instead.  If
+@var{new} is a string, this is the message and there is no replacement
+variable.  If it is provided, @var{when} should be a string indicating
+when the variable was first made obsolete, for example a date or a
+release number.
+@end defmac
+
+You can make two variables synonyms and declare one obsolete at the
+same time using the macro @code{define-obsolete-variable-alias}.
+
+@defmac define-obsolete-variable-alias variable new &optional when docstring
+This macro defines the symbol @var{variable} as a variable alias for
+symbol @var{new} and warns that @var{variable} is obsolete.  If it is
+provided, @var{when} should be a string indicating when @var{variable}
+was first made obsolete.  The optional argument @var{docstring}
+specifies the documentation string for @var{variable}.  If
+@var{docstring} is omitted or nil, @var{variable} uses the
+documentation string of @var{new} unless it already has one.
+@end defmac
+
 @defun indirect-variable variable
 This function returns the variable at the end of the chain of aliases
 of @var{variable}.  If @var{variable} is not a symbol, or if @var{variable} is
 not defined as an alias, the function returns @var{variable}.
+
+This function signals a @code{cyclic-variable-indirection} error if
+there is a loop in the chain of symbols.
 @end defun
 
 @example
@@ -1760,8 +1800,8 @@ nor any other file local variable.  It does not check whether a mode
 is specified in the local variables list at the end of the file.
 @end defun
 
-  If a file local variable list could specify a function that will
-be called later, or an expression that will be executed later, simply
+  If a file local variable list could specify a function that would
+be called later, or an expression that would be executed later, simply
 visiting a file could take over your Emacs.  To prevent this, Emacs
 takes care not to allow local variable lists to set such variables.