aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2012-11-06 22:39:33 -0500
committerStefan Monnier2012-11-06 22:39:33 -0500
commitb715ed4447b025d713fc68a7af3728c2d463974b (patch)
tree1a5e20bc74645a4eee84d40bc6d3cb32a63907ed
parentd57c286eea2c3bc69e8aeac6c4a1458625032a73 (diff)
downloademacs-b715ed4447b025d713fc68a7af3728c2d463974b.tar.gz
emacs-b715ed4447b025d713fc68a7af3728c2d463974b.zip
* lisp/emacs-lisp/gv.el (gv-define-simple-setter): Don't evaluate `val'
twice when `fix-return' is set. Fixes: debbugs:12813
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/emacs-lisp/gv.el6
2 files changed, 7 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b88baaa2f0a..187ff2d7e1d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12012-11-07 Stefan Monnier <monnier@iro.umontreal.ca> 12012-11-07 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * emacs-lisp/gv.el (gv-define-simple-setter): Don't evaluate `val'
4 twice when `fix-return' is set (bug#12813).
5
3 * emacs-lisp/cl.el (defsetf): Pass the third arg to 6 * emacs-lisp/cl.el (defsetf): Pass the third arg to
4 gv-define-simple-setter (bug#12812). 7 gv-define-simple-setter (bug#12812).
5 8
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
213instead the assignment is turned into (prog1 VAL (SETTER ARGS... VAL)) 213instead the assignment is turned into (prog1 VAL (SETTER ARGS... VAL))
214so as to preserve the semantics of `setf'." 214so as to preserve the semantics of `setf'."
215 (declare (debug (sexp (&or symbolp lambda-expr) &optional sexp))) 215 (declare (debug (sexp (&or symbolp lambda-expr) &optional sexp)))
216 (let ((set-call `(cons ',setter (append args (list val)))))
217 `(gv-define-setter ,name (val &rest args) 216 `(gv-define-setter ,name (val &rest args)
218 ,(if fix-return `(list 'prog1 val ,set-call) set-call)))) 217 ,(if fix-return
218 `(macroexp-let2 nil v val
219 (cons ',setter (append args (list v))))
220 `(cons ',setter (append args (list val))))))
219 221
220;;; Typical operations on generalized variables. 222;;; Typical operations on generalized variables.
221 223