* doc/lispref/edebug.texi (Specification List): setf is no longer CL-only.
* doc/lispref/lists.texi (List Elements, List Variables): Clarify descriptions
of push and pop for generalized variables.
* doc/lispref/variables.texi (Creating Buffer-Local): Document setq-local and
defvar-local.
(Setting Generalized Variables): Arrange table alphabetically.
+2012-11-07 Chong Yidong <cyd@gnu.org>
+
+ * variables.texi (Creating Buffer-Local): Document setq-local and
+ defvar-local.
+ (Setting Generalized Variables): Arrange table alphabetically.
+
+ * lists.texi (List Elements, List Variables): Clarify descriptions
+ of push and pop for generalized variables.
+
+ * edebug.texi (Specification List): setf is no longer CL-only.
+
2012-11-07 Glenn Morris <rgm@gnu.org>
* variables.texi (Adding Generalized Variables):
A single evaluated expression, which is instrumented.
@item place
-@c I can't see that this index entry is useful without any explanation.
-@c @findex edebug-unwrap
-A place to store a value, as in the Common Lisp @code{setf} construct.
+A generalized variable. @xref{Generalized Variables}.
@item body
Short for @code{&rest form}. See @code{&rest} below.
@end defun
@defmac pop listname
-This macro is a way of examining the @sc{car} of a list,
-and taking it off the list, all at once.
-@c FIXME I don't think is a particularly good way to do it,
-@c but generalized variables have not been introduced yet.
-(In fact, this macro can act on generalized variables, not just lists.
-@xref{Generalized Variables}.)
-
-It operates on the list which is stored in the symbol @var{listname}.
-It removes this element from the list by setting @var{listname}
-to the @sc{cdr} of its old value---but it also returns the @sc{car}
-of that list, which is the element being removed.
+This macro provides a convenient way to examine the @sc{car} of a
+list, and take it off the list, all at once. It operates on the list
+stored in @var{listname}. It removes the first element from the list,
+saves the @sc{cdr} into @var{listname}, then returns the removed
+element.
+
+In the simplest case, @var{listname} is an unquoted symbol naming a
+list; in that case, this macro is equivalent to @w{@code{(prog1
+(car listname) (setq listname (cdr listname)))}}.
@example
x
@result{} (b c)
@end example
-@noindent
+More generally, @var{listname} can be a generalized variable. In that
+case, this macro saves into @var{listname} using @code{setf}.
+@xref{Generalized Variables}.
+
For the @code{push} macro, which adds an element to a list,
@xref{List Variables}.
@end defmac
These functions, and one macro, provide convenient ways
to modify a list which is stored in a variable.
-@defmac push newelt listname
-This macro provides an alternative way to write
-@code{(setq @var{listname} (cons @var{newelt} @var{listname}))}.
-@c FIXME I don't think is a particularly good way to do it,
-@c but generalized variables have not been introduced yet.
-(In fact, this macro can act on generalized variables, not just lists.
-@xref{Generalized Variables}.)
+@defmac push element listname
+This macro creates a new list whose @sc{car} is @var{element} and
+whose @sc{cdr} is the list specified by @var{listname}, and saves that
+list in @var{listname}. In the simplest case, @var{listname} is an
+unquoted symbol naming a list, and this macro is equivalent
+to @w{@code{(setq @var{listname} (cons @var{element} @var{listname}))}}.
@example
(setq l '(a b))
@result{} (c a b)
@end example
-@noindent
+More generally, @code{listname} can be a generalized variable. In
+that case, this macro does the equivalent of @w{@code{(setf
+@var{listname} (cons @var{element} @var{listname}))}}.
+@xref{Generalized Variables}.
+
For the @code{pop} macro, which removes the first element from a list,
@xref{List Elements}.
@end defmac
@code{remove-hook}.
@end deffn
+@defmac setq-local variable value
+This macro creates a buffer-local binding in the current buffer for
+@var{variable}, and gives it the buffer-local value @var{value}. It
+is equivalent to calling @code{make-local-variable} followed by
+@code{setq}. @var{variable} should be an unquoted symbol.
+@end defmac
+
@deffn Command make-variable-buffer-local variable
This function marks @var{variable} (a symbol) automatically
buffer-local, so that any subsequent attempt to set it will make it
@code{make-variable-buffer-local} can be the best solution.
@end deffn
+@defmac defvar-local variable value &optional docstring
+This macro defines @var{variable} as a variable with initial value
+@var{value} and @var{docstring}, and marks it as automatically
+buffer-local. It is equivalent to calling @code{defvar} followed by
+@code{make-variable-buffer-local}. @var{variable} should be an
+unquoted symbol.
+@end defmac
+
@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,
@error{} Wrong type argument: integerp, 1000.0
@end example
-@c FIXME? Not sure this is the right place for this section.
@node Generalized Variables
@section Generalized Variables
of arrays, properties of symbols, and many other locations are also
places where Lisp values are stored.
-@c FIXME? Not sure this is a useful analogy...
Generalized variables are analogous to ``lvalues'' in the C
language, where @samp{x = a[i]} gets an element from an array
and @samp{a[i] = x} stores an element using the same notation.
A call to any of the following standard Lisp functions:
@smallexample
-car cdr nth nthcdr
-caar cadr cdar cddr
-aref elt get gethash
-symbol-function symbol-value symbol-plist
+aref cddr symbol-function
+car elt symbol-plist
+caar get symbol-value
+cadr gethash
+cdr nth
+cdar nthcdr
@end smallexample
@item
-The following Emacs-specific functions are also @code{setf}-able:
+A call to any of the following Emacs-specific functions:
@smallexample
default-value process-get
@end itemize
@noindent
-Using any forms other than these in the @var{place} argument to
-@code{setf} will signal an error.
+@code{setf} signals an error if you pass a @var{place} form that it
+does not know how to handle.
@c And for cl-lib's cl-getf.
Note that for @code{nthcdr}, the list argument of the function must
The sampling rate can be based on CPU time (only supported on some
systems), or based on memory allocations.
++++
** CL-style generalized variables are now in core Elisp.
`setf' is autoloaded; `push' and `pop' accept generalized variables.
You can define your own generalized variables using `gv-define-simple-setter',
*** Set `debug-on-message' to enter the debugger when a certain
message is displayed in the echo area. This can be useful when trying
to work out which code is doing something.
-
+---
*** New var `inhibit-debugger', automatically set to prevent accidental
recursive invocations.
+++
*** `tty-top-frame' returns the topmost frame of a text terminal.
++++
** New macros `setq-local' and `defvar-local'.
+++