Subject: bug#14387: 24.3; The return value of setf is not the last VAL in the list

From: Stefan Monnier <[email-masked]>
Date: Tue, 14 May 2013 22:01:00 -0400

> (let ((pl '(aaa bbb))) (setf (cl-getf pl 'aaa) 'ccc))
> (aaa ccc)    ; This should be ccc

Oops, good point.  The patch below should fix it (installed in trunk).

        Stefan

=== modified file 'lisp/emacs-lisp/cl-extra.el'
--- lisp/emacs-lisp/cl-extra.el	2013-01-02 16:13:04 +0000
+++ lisp/emacs-lisp/cl-extra.el	2013-05-15 01:55:53 +0000
@@ -597,8 +597,11 @@
                   (macroexp-let2 nil d def
                     (funcall do `(cl-getf ,getter ,k ,d)
                              (lambda (v)
-                               (funcall setter
-                                        `(cl--set-getf ,getter ,k ,v))))))))))
+                               (macroexp-let2 nil val v
+                                 `(progn
+                                    ,(funcall setter
+                                              `(cl--set-getf ,getter ,k ,val))
+                                    ,val))))))))))
   (setplist '--cl-getf-symbol-- plist)
   (or (get '--cl-getf-symbol-- tag)
       ;; Originally we called cl-get here,