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.
This commit is contained in:
Stefan Monnier 2025-04-12 23:00:08 -04:00
parent b99893af1e
commit f3e0bdf1b9

View file

@ -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))))