diff lispref/variables.texi @ 12098:a6eb5f12b0f3

*** empty log message ***
author Karl Heuer <kwzh@gnu.org>
date Tue, 06 Jun 1995 19:21:15 +0000
parents 73dc8205d259
children 74615e68b2cd
line wrap: on
line diff
--- a/lispref/variables.texi	Tue Jun 06 03:11:10 1995 +0000
+++ b/lispref/variables.texi	Tue Jun 06 19:21:15 1995 +0000
@@ -231,6 +231,12 @@
 @code{condition-case} (@pxref{Errors}).
 @end itemize
 
+  Variables can also have buffer-local bindings (@pxref{Buffer-Local
+Variables}); a few variables have terminal-local bindings
+(@pxref{Multiple Displays}).  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.
+
 @defvar max-specpdl-size
 @cindex variable limit error
 @cindex evaluation error
@@ -409,6 +415,12 @@
 evaluates it and sets @var{symbol} to the result.  (If @var{value} is
 omitted, the value of @var{symbol} is not changed in any case.)
 
+When you evaluate a top-level @code{defvar} form with @kbd{C-M-x} in
+Emacs Lisp mode (@code{eval-defun}), a special feature of
+@code{eval-defun} evaluates it as a @code{defconst}.  The purpose of
+this is to make sure the variable's value is reinitialized, when you ask
+for it specifically.
+
 If @var{symbol} has a buffer-local binding in the current buffer,
 @code{defvar} sets the default value, not the local value.
 @xref{Buffer-Local Variables}.
@@ -532,9 +544,9 @@
 @end defun
 
   If a user option variable has a @code{variable-interactive} property,
-@code{set-variable} uses that value to control reading the new value for
-the variable.  The property's value is used as if it were the argument
-to @code{interactive}.
+the @code{set-variable} command uses that value to control reading the
+new value for the variable.  The property's value is used as if it were
+the argument to @code{interactive}.
 
   @strong{Warning:} If the @code{defconst} and @code{defvar} special
 forms are used while the variable has a local binding, they set the
@@ -714,7 +726,12 @@
 @defun add-to-list symbol element
 This function sets the variable @var{symbol} by consing @var{element}
 onto the old value, if @var{element} is not already a member of that
-value.  The value of @var{symbol} had better be a list already.
+value.  It returns the resulting list, whether updated or not.  The
+value of @var{symbol} had better be a list already before the call.
+
+The argument @var{symbol} is not implicitly quoted; @code{add-to-list}
+is an ordinary function, like @code{set} and unlike @code{setq}.  Quote
+the argument yourself if that is what you want.
 
 Here's a scenario showing how to use @code{add-to-list}:
 
@@ -944,6 +961,12 @@
 the effect will be.
 @end itemize
 
+  In either case, you should define the variable with @code{defvar}.
+This helps other people understand your program by telling them to look
+for inter-function usage.  It also avoids a warning from the byte
+compiler.  Choose the variable's name to avoid name conflicts---don't
+use short names like @code{x}.
+
 @node Buffer-Local Variables
 @section Buffer-Local Variables
 @cindex variables, buffer-local
@@ -1027,7 +1050,7 @@
 (setq foo 'a)
 (let ((foo 'temp))
   (set-buffer "b")
-  @dots{})
+  @var{body}@dots{})
 @group
 foo @result{} 'a      ; @r{The old buffer-local value from buffer @samp{a}}
                ;   @r{is now the default value.}
@@ -1107,6 +1130,10 @@
 between different kinds of bindings; it knows only which variable the
 binding was made for.
 
+If the variable is terminal-local, this function signals an error.  Such
+variables cannot have buffer-local bindings as well.  @xref{Multiple
+Displays}.
+
 @strong{Note:} do not use @code{make-local-variable} for a hook
 variable.  Instead, use @code{make-local-hook}.  @xref{Hooks}.
 @end deffn
@@ -1119,6 +1146,12 @@
 The value returned is @var{variable}.
 @end deffn
 
+@defun local-variable-p variable &optional buffer
+This returns @code{t} if @var{variable} is buffer-local in buffer
+@var{buffer} (which defaults to the current buffer); otherwise,
+@code{nil}.
+@end defun
+
 @defun buffer-local-variables &optional buffer
 This function returns a list describing the buffer-local variables in
 buffer @var{buffer}.  It returns an association list (@pxref{Association
@@ -1153,12 +1186,6 @@
 list does @emph{not} change the local values of the variables.
 @end defun
 
-@defun local-variable-p variable
-This returns @code{t} if @var{variable} is buffer-local in the current
-buffer.  It is much faster to get the answer this way than to examine
-the value of @code{buffer-local-variables}.
-@end defun
-
 @deffn Command kill-local-variable variable
 This function deletes the buffer-local binding (if any) for
 @var{variable} (a symbol) in the current buffer.  As a result, the