]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow setq-local to set more than one variable
authorJordon Biondo <jordonbiondo@gmail.com>
Fri, 11 Oct 2019 05:58:42 +0000 (07:58 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 11 Oct 2019 05:58:42 +0000 (07:58 +0200)
* lisp/subr.el (setq-local): Allow taking pairs of values (bug#26923).

lisp/subr.el

index cb59802f8b8571639d413f5509d00b99655d91d1..2acac3a0518f0513190d0469c86adf88c6c21935 100644 (file)
@@ -143,11 +143,22 @@ of previous VARs.
       (push `(set-default ',(pop args) ,(pop args)) exps))
     `(progn . ,(nreverse exps))))
 
-(defmacro setq-local (var val)
-  "Set variable VAR to value VAL in current buffer."
+(defmacro setq-local (&rest args)
+  "Set each SYM to the value of its VAL in the current buffer.
+
+\(fn [SYM VAL]...)"
   ;; Can't use backquote here, it's too early in the bootstrap.
   (declare (debug (symbolp form)))
-  (list 'set (list 'make-local-variable (list 'quote var)) val))
+  (let ((expr))
+    (while args
+      (setq expr
+            (cons
+             (list 'set
+                   (list 'make-local-variable (list 'quote (car args)))
+                   (car (cdr args)))
+             expr))
+      (setq args (cdr (cdr args))))
+    (cons 'progn (nreverse expr))))
 
 (defmacro defvar-local (var val &optional docstring)
   "Define VAR as a buffer-local variable with default value VAL.