diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index c588e81dd1f..6e7a0b7a648 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,8 @@ +2012-11-07 Glenn Morris + + * variables.texi (Adding Generalized Variables): + Update description of FIX-RETURN expansion. + 2012-11-06 Glenn Morris * variables.texi (Setting Generalized Variables): diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index a7134af20bd..fb98b3cd035 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -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 diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index bd815e3df9f..49f86ef093b 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,8 @@ +2012-11-07 Glenn Morris + + * cl.texi (Obsolete Setf Customization): + Revert defsetf example to the more correct let rather than prog1. + 2012-11-06 Glenn Morris * cl.texi (Overview): Mention EIEIO here, as well as the appendix. diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index a5a696b6b16..e39186c1222 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -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: diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 187ff2d7e1d..cfd79fc57ef 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-11-07 Glenn Morris + + * emacs-lisp/gv.el (gv-letplace): Fix doc typo. + (gv-define-simple-setter): Update doc of `fix-return'. + 2012-11-07 Stefan Monnier * emacs-lisp/gv.el (gv-define-simple-setter): Don't evaluate `val' diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index a0c412a9504..145c48c670e 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -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)