]> git.eshelyaron.com Git - emacs.git/commitdiff
lisp/subr.el (setq-local): Make local after evaluating the new value
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 13 Apr 2025 03:00:08 +0000 (23:00 -0400)
committerEshel Yaron <me@eshelyaron.com>
Sun, 13 Apr 2025 20:54:06 +0000 (22:54 +0200)
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

index 1ddb19cc084a6d4468b8cc4c9498e025037c171f..47e020d4337e426255b8b5db575a0cc4a103d582 100644 (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))))