From 287c7697892a260628854cce74b15d651c948516 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 12 Apr 2025 23:00:08 -0400 Subject: [PATCH] lisp/subr.el (setq-local): Make local after evaluating the new value In case the evaluation needs to look at the variable's value, make sure we make it buffer-local afterwards. (cherry picked from commit f3e0bdf1b98ceeb055065766db53c0c6218840c4) --- lisp/subr.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index 1ddb19cc084..47e020d4337 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -185,9 +185,10 @@ pair. ;; Can't use backquote here, it's too early in the bootstrap. (setq expr (cons - (list 'set - (list 'make-local-variable (list 'quote (car pairs))) - (car (cdr pairs))) + (list 'setq (car pairs) + (list 'prog1 + (car (cdr pairs)) + (list 'make-local-variable (list 'quote (car pairs))))) expr)) (setq pairs (cdr (cdr pairs)))) (macroexp-progn (nreverse expr)))) -- 2.39.5