emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 88f0c56 1/3: Allow setq-local to set more than one


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 88f0c56 1/3: Allow setq-local to set more than one variable
Date: Fri, 11 Oct 2019 02:28:33 -0400 (EDT)

branch: master
commit 88f0c5662d7ace5e1dd770f8f0cc489d02a5876b
Author: Jordon Biondo <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Allow setq-local to set more than one variable
    
    * lisp/subr.el (setq-local): Allow taking pairs of values (bug#26923).
---
 lisp/subr.el | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index cb59802..2acac3a 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]