diff lispref/variables.texi @ 12067:73dc8205d259

*** empty log message ***
author Karl Heuer <kwzh@gnu.org>
date Mon, 05 Jun 1995 12:23:13 +0000
parents a13093894b9a
children a6eb5f12b0f3
line wrap: on
line diff
--- a/lispref/variables.texi	Sun Jun 04 01:34:39 1995 +0000
+++ b/lispref/variables.texi	Mon Jun 05 12:23:13 1995 +0000
@@ -708,6 +708,39 @@
 @end quotation
 @end defun
 
+  One other function for setting a variable is designed to add
+an element to a list if it is not already present in the list.
+
+@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.
+
+Here's a scenario showing how to use @code{add-to-list}:
+
+@example
+(setq foo '(a b))
+     @result{} (a b)
+
+(add-to-list 'foo 'c)     ;; @r{Add @code{c}.}
+     @result{} (c a b)
+
+(add-to-list 'foo 'b)     ;; @r{No effect.}
+     @result{} (c a b)
+
+foo                       ;; @r{@code{foo} was changed.}
+     @result{} (c a b)
+@end example
+@end defun
+
+  An equivalent expression for @code{(add-to-list '@var{var}
+@var{value})} is this:
+
+@example
+(or (member @var{value} @var{var})
+    (setq @var{var} (cons @var{value} @var{var})))
+@end example
+
 @node Variable Scoping
 @section Scoping Rules for Variable Bindings
 
@@ -921,7 +954,8 @@
 kind of variable binding: @dfn{buffer-local} bindings, which apply only
 to one buffer.  Emacs Lisp is meant for programming editing commands,
 and having different values for a variable in different buffers is an
-important customization method.
+important customization method.  (A few variables have bindings that
+are local to a given X terminal; see @ref{Multiple Displays}.)
 
 @menu
 * Intro to Buffer-Local::      Introduction and concepts.
@@ -1072,6 +1106,9 @@
 variable does not work.  This is because @code{let} does not distinguish
 between different kinds of bindings; it knows only which variable the
 binding was made for.
+
+@strong{Note:} do not use @code{make-local-variable} for a hook
+variable.  Instead, use @code{make-local-hook}.  @xref{Hooks}.
 @end deffn
 
 @deffn Command make-variable-buffer-local variable
@@ -1116,6 +1153,12 @@
 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
@@ -1277,4 +1320,3 @@
 @end group
 @end example
 @end defun
-