aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordon Biondo2019-10-11 07:58:42 +0200
committerLars Ingebrigtsen2019-10-11 07:58:42 +0200
commit88f0c5662d7ace5e1dd770f8f0cc489d02a5876b (patch)
treea0f207756abd8dd4105c240e54272f1eb2eb37da
parentb5d2c6ee018df3cab96d44bb50eaa933aa1d865e (diff)
downloademacs-88f0c5662d7ace5e1dd770f8f0cc489d02a5876b.tar.gz
emacs-88f0c5662d7ace5e1dd770f8f0cc489d02a5876b.zip
Allow setq-local to set more than one variable
* lisp/subr.el (setq-local): Allow taking pairs of values (bug#26923).
-rw-r--r--lisp/subr.el17
1 files changed, 14 insertions, 3 deletions
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.
143 (push `(set-default ',(pop args) ,(pop args)) exps)) 143 (push `(set-default ',(pop args) ,(pop args)) exps))
144 `(progn . ,(nreverse exps)))) 144 `(progn . ,(nreverse exps))))
145 145
146(defmacro setq-local (var val) 146(defmacro setq-local (&rest args)
147 "Set variable VAR to value VAL in current buffer." 147 "Set each SYM to the value of its VAL in the current buffer.
148
149\(fn [SYM VAL]...)"
148 ;; Can't use backquote here, it's too early in the bootstrap. 150 ;; Can't use backquote here, it's too early in the bootstrap.
149 (declare (debug (symbolp form))) 151 (declare (debug (symbolp form)))
150 (list 'set (list 'make-local-variable (list 'quote var)) val)) 152 (let ((expr))
153 (while args
154 (setq expr
155 (cons
156 (list 'set
157 (list 'make-local-variable (list 'quote (car args)))
158 (car (cdr args)))
159 expr))
160 (setq args (cdr (cdr args))))
161 (cons 'progn (nreverse expr))))
151 162
152(defmacro defvar-local (var val &optional docstring) 163(defmacro defvar-local (var val &optional docstring)
153 "Define VAR as a buffer-local variable with default value VAL. 164 "Define VAR as a buffer-local variable with default value VAL.