summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/gv.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2012-11-06 22:39:33 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2012-11-06 22:39:33 -0500
commitb715ed4447b025d713fc68a7af3728c2d463974b (patch)
tree1a5e20bc74645a4eee84d40bc6d3cb32a63907ed /lisp/emacs-lisp/gv.el
parentd57c286eea2c3bc69e8aeac6c4a1458625032a73 (diff)
downloademacs-b715ed4447b025d713fc68a7af3728c2d463974b.tar.gz
* lisp/emacs-lisp/gv.el (gv-define-simple-setter): Don't evaluate `val'
twice when `fix-return' is set. Fixes: debbugs:12813
Diffstat (limited to 'lisp/emacs-lisp/gv.el')
-rw-r--r--lisp/emacs-lisp/gv.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el
index 3dd021f9e74..a0c412a9504 100644
--- a/lisp/emacs-lisp/gv.el
+++ b/lisp/emacs-lisp/gv.el
@@ -213,9 +213,11 @@ 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))
so as to preserve the semantics of `setf'."
(declare (debug (sexp (&or symbolp lambda-expr) &optional sexp)))
- (let ((set-call `(cons ',setter (append args (list val)))))
`(gv-define-setter ,name (val &rest args)
- ,(if fix-return `(list 'prog1 val ,set-call) set-call))))
+ ,(if fix-return
+ `(macroexp-let2 nil v val
+ (cons ',setter (append args (list v))))
+ `(cons ',setter (append args (list val))))))
;;; Typical operations on generalized variables.