summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2001-05-29 08:56:24 +0000
committerGerd Moellmann <gerd@gnu.org>2001-05-29 08:56:24 +0000
commit82d336bb15a1145e9d6f082aa9ac5513d84459c3 (patch)
treecc7d03c9ecebadf04cbec7f002dd005947603908
parente8cf9ab5704c801a5aa9436703c85200192ce787 (diff)
downloademacs-82d336bb15a1145e9d6f082aa9ac5513d84459c3.tar.gz
*** empty log message ***
-rw-r--r--lispref/variables.texi41
1 files changed, 21 insertions, 20 deletions
diff --git a/lispref/variables.texi b/lispref/variables.texi
index 6cea346a00c..3d6d83a8aa5 100644
--- a/lispref/variables.texi
+++ b/lispref/variables.texi
@@ -1657,32 +1657,33 @@ local bindings, we will provide it in a subsequent Emacs version.
@node Variable Aliases
@section Variable Aliases
- During the maintenance of Lisp programs, it is sometimes useful to
-make two variables synonyms for each other, so that both variables
-invariably refer to the same value. When a program variable slightly
-changes meaning, or when a variable name is chosen badly to begin
-with, it is desirable to rename that variable. For compatibility with
-older versions of the program it is also desirable to not break code
-using the original variable name. This can be done with
-@code{defvaralias}.
-
-@defun defvaralias old-name new-name
-This function defines the symbol @var{old-name} as a variable alias
-for symbol @var{new-name}. Subsequently, retrieving the value of
-@var{old-name} returns the value of @var{new-name}, and changing the
-value of @var{old-name} changes the value of @var{new-name}.
-@end defun
-
-@defun indirect-variable name
-This function returns the variable at the end of the variable chain
-of @var{name}. If @var{name} is not a symbol or if @var{name}
-is not a variable alias, this function returns @var{name} unchanged.
+ It is sometimes useful to make two variables synonyms, so that both
+variables always have the same value, and changing either one also
+changes the other. Whenever you change the name of a
+variable---either because you realize its old name was not well
+chosen, or because its meaning has partly changed---it can be useful
+to keep the old name as an @emph{alias} of the new one for
+compatibility. You can do this with @code{defvaralias}.
+
+@defmacro defvaralias alias-var base-var
+This function defines the symbol @var{alias-var} as a variable alias
+for symbol @var{base-var}. This means that retrieving the value of
+@var{alias-var} returns the value of @var{base-var}, and changing the
+value of @var{alias-var} changes the value of @var{base-var}.
+@end defmacro
+
+@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}.
@end defun
@example
(defvaralias 'foo 'bar)
(indirect-variable 'foo)
@result{} bar
+(indirect-variable 'bar)
+ @result{} bar
(setq bar 2)
bar
@result{} 2