From: Jordon Biondo Date: Fri, 11 Oct 2019 05:58:42 +0000 (+0200) Subject: Allow setq-local to set more than one variable X-Git-Tag: emacs-27.0.90~1161 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=88f0c5662d7ace5e1dd770f8f0cc489d02a5876b;p=emacs.git Allow setq-local to set more than one variable * lisp/subr.el (setq-local): Allow taking pairs of values (bug#26923). --- diff --git a/lisp/subr.el b/lisp/subr.el index cb59802f8b8..2acac3a0518 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -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.