From eda8ea685802e4e07e28351f65b5e24661a384fe Mon Sep 17 00:00:00 2001 From: Michael Heerdegen Date: Mon, 6 May 2019 14:58:24 +0200 Subject: [PATCH] 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. --- lisp/emacs-lisp/gv.el | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) 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. -- 2.39.2