From: Michael Heerdegen Date: Mon, 6 May 2019 12:58:24 +0000 (+0200) Subject: Fix alist-get gv setter not returning VAL X-Git-Tag: emacs-27.0.90~2931 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=eda8ea685802e4e07e28351f65b5e24661a384fe;p=emacs.git Fix alist-get gv setter not returning VAL This fixes Bug#35546. * lisp/emacs-lisp/gv.el (alist-get): Make setter return the set value to preserve 'setf' semantics. --- diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index 4ea3ce84fc6..bdd15748206 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -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.