diff options
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/gv.el | 8 |
1 files changed, 6 insertions, 2 deletions
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) |