]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix alist-get gv setter not returning VAL
authorMichael Heerdegen <michael_heerdegen@web.de>
Mon, 6 May 2019 12:58:24 +0000 (14:58 +0200)
committerMichael Heerdegen <michael_heerdegen@web.de>
Thu, 9 May 2019 20:28:19 +0000 (22:28 +0200)
This fixes Bug#35546.

* lisp/emacs-lisp/gv.el (alist-get): Make setter return the set value
to preserve 'setf' semantics.

lisp/emacs-lisp/gv.el

index 4ea3ce84fc63f91f2dcdcfc165eedeb3129d046f..bdd15748206e5c1d2d9ff592c8bf85d66445a077 100644 (file)
@@ -392,18 +392,20 @@ The return value is the last VAL in the list.
                                  ,(funcall setter
                                            `(cons (setq ,p (cons ,k ,v))
                                                   ,getter)))))
-                         (cond
-                          ((null remove) set-exp)
-                          ((or (eql v default)
-                               (and (eq (car-safe v) 'quote)
-                                    (eq (car-safe default) 'quote)
-                                    (eql (cadr v) (cadr default))))
-                           `(if ,p ,(funcall setter `(delq ,p ,getter))))
-                          (t
-                           `(cond
-                             ((not (eql ,default ,v)) ,set-exp)
-                             (,p ,(funcall setter
-                                           `(delq ,p ,getter)))))))))))))))
+                         `(progn
+                            ,(cond
+                             ((null remove) set-exp)
+                             ((or (eql v default)
+                                  (and (eq (car-safe v) 'quote)
+                                       (eq (car-safe default) 'quote)
+                                       (eql (cadr v) (cadr default))))
+                              `(if ,p ,(funcall setter `(delq ,p ,getter))))
+                             (t
+                              `(cond
+                                ((not (eql ,default ,v)) ,set-exp)
+                                (,p ,(funcall setter
+                                              `(delq ,p ,getter))))))
+                            ,v))))))))))
 
 
 ;;; Some occasionally handy extensions.