1 |
@c -*-texinfo-*- |
@c -*-texinfo-*- |
2 |
@c This is part of the GNU Emacs Lisp Reference Manual. |
@c This is part of the GNU Emacs Lisp Reference Manual. |
3 |
@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000 |
@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000 |
4 |
@c Free Software Foundation, Inc. |
@c Free Software Foundation, Inc. |
5 |
@c See the file elisp.texi for copying conditions. |
@c See the file elisp.texi for copying conditions. |
6 |
@setfilename ../info/variables |
@setfilename ../info/variables |
7 |
@node Variables, Functions, Control Structures, Top |
@node Variables, Functions, Control Structures, Top |
207 |
@result{} 2 |
@result{} 2 |
208 |
@end group |
@end group |
209 |
@group |
@group |
210 |
(let ((Y 1) |
(let ((Y 1) |
211 |
(Z Y)) |
(Z Y)) |
212 |
(list Y Z)) |
(list Y Z)) |
213 |
@result{} (1 2) |
@result{} (1 2) |
767 |
x ; @r{@code{x} now has a global value.} |
x ; @r{@code{x} now has a global value.} |
768 |
@result{} 3 |
@result{} 3 |
769 |
@group |
@group |
770 |
(let ((x 5)) |
(let ((x 5)) |
771 |
(setq x 6) ; @r{The local binding of @code{x} is set.} |
(setq x 6) ; @r{The local binding of @code{x} is set.} |
772 |
x) |
x) |
773 |
@result{} 6 |
@result{} 6 |
784 |
@group |
@group |
785 |
(setq x 10 ; @r{Notice that @code{x} is set before} |
(setq x 10 ; @r{Notice that @code{x} is set before} |
786 |
y (1+ x)) ; @r{the value of @code{y} is computed.} |
y (1+ x)) ; @r{the value of @code{y} is computed.} |
787 |
@result{} 11 |
@result{} 11 |
788 |
@end group |
@end group |
789 |
@end example |
@end example |
790 |
@end defspec |
@end defspec |
1350 |
(mode-name . "Fundamental") |
(mode-name . "Fundamental") |
1351 |
@dots{} |
@dots{} |
1352 |
@group |
@group |
1353 |
;; @r{Next, non-built-in buffer-local variables.} |
;; @r{Next, non-built-in buffer-local variables.} |
1354 |
;; @r{This one is buffer-local and void:} |
;; @r{This one is buffer-local and void:} |
1355 |
foobar |
foobar |
1356 |
;; @r{This one is buffer-local and nonvoid:} |
;; @r{This one is buffer-local and nonvoid:} |
1676 |
to keep the old name as an @emph{alias} of the new one for |
to keep the old name as an @emph{alias} of the new one for |
1677 |
compatibility. You can do this with @code{defvaralias}. |
compatibility. You can do this with @code{defvaralias}. |
1678 |
|
|
1679 |
@defmac defvaralias alias-var base-var |
@defun defvaralias alias-var base-var [docstring] |
1680 |
This function defines the symbol @var{alias-var} as a variable alias |
This function defines the symbol @var{alias-var} as a variable alias |
1681 |
for symbol @var{base-var}. This means that retrieving the value of |
for symbol @var{base-var}. This means that retrieving the value of |
1682 |
@var{alias-var} returns the value of @var{base-var}, and changing the |
@var{alias-var} returns the value of @var{base-var}, and changing the |
1683 |
value of @var{alias-var} changes the value of @var{base-var}. |
value of @var{alias-var} changes the value of @var{base-var}. |
1684 |
@end defmac |
|
1685 |
|
If the @var{docstring} argument is present, it specifies the documentation for |
1686 |
|
@var{alias-var}; otherwise, it has the same documentation as @var{base-var}, |
1687 |
|
if any. |
1688 |
|
@end defun |
1689 |
|
|
1690 |
@defun indirect-variable variable |
@defun indirect-variable variable |
1691 |
This function returns the variable at the end of the chain of aliases |
This function returns the variable at the end of the chain of aliases |
1733 |
given to @code{normal-mode}. |
given to @code{normal-mode}. |
1734 |
@end defun |
@end defun |
1735 |
|
|
1736 |
If a file local variable list could specify the a function that will |
If a file local variable list could specify a function that will |
1737 |
be called later, or an expression that will be executed later, simply |
be called later, or an expression that will be executed later, simply |
1738 |
visiting a file could take over your Emacs. To prevent this, Emacs |
visiting a file could take over your Emacs. To prevent this, Emacs |
1739 |
takes care not to allow local variable lists to set such variables. |
takes care not to allow local variable lists to set such variables. |
1740 |
|
|
1741 |
For one thing, any variable whose name ends in @samp{-function}, |
For one thing, any variable whose name ends in @samp{-command}, |
1742 |
@samp{-functions}, @samp{-hook}, @samp{-hooks}, @samp{-form}, |
@samp{-frame-alist}, @samp{-function}, @samp{-functions}, |
1743 |
@samp{-forms}, @samp{-program}, @samp{-command} or @samp{-predicate} |
@samp{-hook}, @samp{-hooks}, @samp{-form}, @samp{-forms}, @samp{-map}, |
1744 |
cannot be set in a local variable list. In general, you should use such |
@samp{-map-alist}, @samp{-mode-alist}, @samp{-program}, or |
1745 |
a name whenever it is appropriate for the variable's meaning. |
@samp{-predicate} cannot be set in a local variable list. In general, |
1746 |
|
you should use such a name whenever it is appropriate for the |
1747 |
|
variable's meaning. The variables @samp{font-lock-keywords}, |
1748 |
|
@samp{font-lock-keywords-[0-9]}, and |
1749 |
|
@samp{font-lock-syntactic-keywords} cannot be set in a local variable |
1750 |
|
list, either. |
1751 |
|
|
1752 |
In addition, any variable whose name has a non-@code{nil} |
In addition, any variable whose name has a non-@code{nil} |
1753 |
@code{risky-local-variable} property is also ignored. So are |
@code{risky-local-variable} property is also ignored. So are all |
1754 |
all variables listed in @code{ignored-local-variables}: |
variables listed in @code{ignored-local-variables}: |
1755 |
|
|
1756 |
@defvar ignored-local-variables |
@defvar ignored-local-variables |
1757 |
This variable holds a list of variables that should not be |
This variable holds a list of variables that should not be |
1759 |
for one of these variables is ignored. |
for one of these variables is ignored. |
1760 |
@end defvar |
@end defvar |
1761 |
|
|
1762 |
|
@defun risky-local-variable-p sym |
1763 |
|
Returns non-nil if @var{sym} is risky for any of the reasons stated above. |
1764 |
|
@end defun |
1765 |
|
|
1766 |
The @samp{Eval:} ``variable'' is also a potential loophole, so Emacs |
The @samp{Eval:} ``variable'' is also a potential loophole, so Emacs |
1767 |
normally asks for confirmation before handling it. |
normally asks for confirmation before handling it. |
1768 |
|
|