Commit 2ee1d59f authored by Glenn Morris's avatar Glenn Morris

Small doc updates for generalized variables

* lisp/emacs-lisp/gv.el (gv-letplace): Fix doc typo.
(gv-define-simple-setter): Update doc of `fix-return'.

* doc/lispref/variables.texi (Adding Generalized Variables):
Update description of FIX-RETURN expansion.

* doc/misc/cl.texi (Obsolete Setf Customization):
Revert defsetf example to the more correct let rather than prog1.
parent b715ed44
2012-11-07 Glenn Morris <rgm@gnu.org>
* variables.texi (Adding Generalized Variables):
Update description of FIX-RETURN expansion.
2012-11-06 Glenn Morris <rgm@gnu.org>
* variables.texi (Setting Generalized Variables):
......
......@@ -2089,8 +2089,13 @@ no problem with, e.g., @code{car} and @code{setcar}, because
@code{setcar} returns the value that it set. If your @var{setter}
function does not return @var{value}, use a non-@code{nil} value for
the @var{fix-return} argument of @code{gv-define-simple-setter}. This
wraps the @code{setf} expansion in @code{(prog1 @var{value} @dots{})}
so that it returns the correct result.
expands into something equivalent to
@example
(let ((temp @var{value}))
(@var{setter} @var{args}@dots{} temp)
temp)
@end example
so ensuring that it returns the correct result.
@end defmac
......
2012-11-07 Glenn Morris <rgm@gnu.org>
* cl.texi (Obsolete Setf Customization):
Revert defsetf example to the more correct let rather than prog1.
2012-11-06 Glenn Morris <rgm@gnu.org>
* cl.texi (Overview): Mention EIEIO here, as well as the appendix.
......
......@@ -4950,9 +4950,8 @@ is completely irregular.
@end defmac
@defmac defsetf access-fn update-fn
This is the simpler of two @code{defsetf} forms, and is entirely
obsolete, being replaced by @code{gv-define-simple-setter} in Emacs
24.3.
This is the simpler of two @code{defsetf} forms, and is
replaced by @code{gv-define-simple-setter} in Emacs 24.3.
@xref{Adding Generalized Variables,,,elisp,GNU Emacs Lisp Reference Manual}.
Where @var{access-fn} is the name of a function that accesses a place,
......@@ -4983,8 +4982,9 @@ not suitable, so that the above @code{setf} should be expanded to
something more like
@example
(prog1 @var{value}
(@var{update-fn} @var{arg1} @var{arg2} @var{arg3} @var{value}))
(let ((temp @var{value}))
(@var{update-fn} @var{arg1} @var{arg2} @var{arg3} temp)
temp)
@end example
Some examples are:
......
2012-11-07 Glenn Morris <rgm@gnu.org>
* emacs-lisp/gv.el (gv-letplace): Fix doc typo.
(gv-define-simple-setter): Update doc of `fix-return'.
2012-11-07 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/gv.el (gv-define-simple-setter): Don't evaluate `val'
......
......@@ -111,7 +111,7 @@ DO must return an Elisp expression."
GETTER will be bound to a copyable expression that returns the value
of PLACE.
SETTER will be bound to a function that takes an expression V and returns
and new expression that sets PLACE to V.
a new expression that sets PLACE to V.
BODY should return some Elisp expression E manipulating PLACE via GETTER
and SETTER.
The returned value will then be an Elisp expression that first evaluates
......@@ -209,8 +209,12 @@ to be pure and copyable. Example use:
This macro is an easy-to-use substitute for `gv-define-expander' that works
well for simple place forms. Assignments of VAL to (NAME ARGS...) are
turned into calls of the form (SETTER ARGS... VAL).
If FIX-RETURN is non-nil, then SETTER is not assumed to return VAL and
instead the assignment is turned into (prog1 VAL (SETTER ARGS... VAL))
instead the assignment is turned into something equivalent to
\(let ((temp VAL))
(SETTER ARGS... temp)
temp)
so as to preserve the semantics of `setf'."
(declare (debug (sexp (&or symbolp lambda-expr) &optional sexp)))
`(gv-define-setter ,name (val &rest args)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment