GNU bug report logs - #14387
24.3; The return value of setf is not the last VAL in the list

Previous Next

Package: emacs;

Reported by: 白井 彰 <okshirai <at> gmail.com>

Date: Sat, 11 May 2013 17:53:02 UTC

Severity: normal

Found in version 24.3

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 14387 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: 白井 彰 <okshirai <at> gmail.com>
Cc: 14387 <at> debbugs.gnu.org
Subject: Re: bug#14387: 24.3;
	The return value of setf is not the last VAL in the list
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,





This bug report was last modified 12 years and 14 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.