all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Drew Adams <drew.adams@oracle.com>
Cc: 26923@debbugs.gnu.org
Subject: bug#26923: 25.2; `setq-local': allow multiple assignments or add optional buffer arg
Date: Wed, 09 Oct 2019 10:15:49 +0200	[thread overview]
Message-ID: <877e5epc5m.fsf@gnus.org> (raw)
In-Reply-To: <986f9da4-6f75-48fc-a41c-f6a44343bfa2@default> (Drew Adams's message of "Sun, 14 May 2017 07:15:16 -0700 (PDT)")

Drew Adams <drew.adams@oracle.com> writes:

> 1. I believe this has been discussed before, and presumably the result
>    (decision or lack of one) has been not to make the change, but I'd
>    still suggest that `setq-local', like `setq', should allow multiple
>    assignment pairs.

This was implemented by

Jordon Biondo <jordonbiondo@gmail.com>

but never applied.  Biondo has copyright assignment papers on file, but
apparently the final movement here was this email from Eli:

> > From: Jordon Biondo <jordonbiondo@gmail.com>
> > Date: Wed, 8 Feb 2017 10:59:19 -0500
> > Cc: John Wiegley <jwiegley@gmail.com>, Emacs development discussions
> > <emacs-devel@gnu.org>
> > 
> > My paperwork is now complete, if that's the only thing holding up this patch.
>
> Thanks.  Could you please re-submit your patch, and add to it suitable
> changes to NEWS and to the ELisp manual?

Eli, if you still think this is something that should be done, I can add
the NEWS entry and the manual changes.  I've re-spun the patch for the
current trunk:

diff --git a/lisp/subr.el b/lisp/subr.el
index e361b8324f..8cb8bcef69 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -143,11 +143,22 @@ setq-default
       (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.


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2019-10-09  8:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-14 14:15 bug#26923: 25.2; `setq-local': allow multiple assignments or add optional buffer arg Drew Adams
2019-10-09  8:15 ` Lars Ingebrigtsen [this message]
2019-10-10 10:33   ` Eli Zaretskii
2019-10-10 13:02     ` Robert Pluim
2019-10-10 13:45       ` Eli Zaretskii
2019-10-11  5:56         ` Lars Ingebrigtsen
2019-10-11  6:29           ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877e5epc5m.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=26923@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.