From 29ea21a751ab6e71b2fb34c781131e31fc7b950d Mon Sep 17 00:00:00 2001 From: Michael Heerdegen Date: Wed, 3 Aug 2022 02:06:16 +0200 Subject: [PATCH] WIP: Fix symbol macros used in cl-psetf (Bug#56739) --- lisp/emacs-lisp/cl-macs.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 78d19db479..f3051752ba 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2653,12 +2653,17 @@ cl-psetf \(fn PLACE VAL PLACE VAL ...)" (declare (debug setf)) - (let ((p args) (simple t) (vars nil)) + (let ((p args) (simple t) (vars nil) + (smacros (alist-get :cl-symbol-macros macroexpand-all-environment))) (while p - (if (or (not (symbolp (car p))) (cl--expr-depends-p (nth 1 p) vars)) - (setq simple nil)) - (if (memq (car p) vars) - (error "Destination duplicated in psetf: %s" (car p))) + (when (or (not (symbolp (car p))) + (assq (car p) smacros) + (and (symbolp (nth 1 p)) + (assq (nth 1 p) smacros)) + (cl--expr-depends-p (nth 1 p) vars)) + (setq simple nil)) + (when (memq (car p) vars) + (error "Destination duplicated in psetf: %s" (car p))) (push (pop p) vars) (or p (error "Odd number of arguments to cl-psetf")) (pop p)) -- 2.30.2