From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jordon Biondo Newsgroups: gmane.emacs.devel Subject: giving `setq-local' the same signature as `setq' Date: Wed, 18 Mar 2015 11:26:01 -0400 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1426692393 15099 80.91.229.3 (18 Mar 2015 15:26:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 Mar 2015 15:26:33 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 18 16:26:20 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YYFrP-00006R-KT for ged-emacs-devel@m.gmane.org; Wed, 18 Mar 2015 16:26:19 +0100 Original-Received: from localhost ([::1]:34369 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYFrO-0000qc-OK for ged-emacs-devel@m.gmane.org; Wed, 18 Mar 2015 11:26:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYFrC-0000qT-1m for emacs-devel@gnu.org; Wed, 18 Mar 2015 11:26:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYFrA-0005xM-R5 for emacs-devel@gnu.org; Wed, 18 Mar 2015 11:26:05 -0400 Original-Received: from mail-ig0-x233.google.com ([2607:f8b0:4001:c05::233]:36518) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYFrA-0005x7-Mr for emacs-devel@gnu.org; Wed, 18 Mar 2015 11:26:04 -0400 Original-Received: by igbue6 with SMTP id ue6so103115365igb.1 for ; Wed, 18 Mar 2015 08:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=Y2mui1CE0s30a9ROvRBZeOf3G5Raj+lsZaV2VyzY9Ss=; b=FbO7Z2jftjBCQGTqPFMo/2gvdryUVE/5HFuT5V5ML1VbRn1gml+jEPKHB4dMSKQRMB 1ZQilRiYSEuY4gbMFFSc2AlsTt4A0htJ/o5imD6yRYNfoAFYWgjXnDBaLK59kHKlOc5F H9BZcF1M97jLa5EHF3j8NZcicT/seCJq49MIJY+OAcdT5uWpgMvZjPanRiGzPCRqUlKS fn0AVXRZfRLSmOo57JhXJtFvB17vnRiF3KKwDfE+aM8kYvSzZrSzaHtR4irnSPAmKB+j iZjw0mnFNDuwg6gfFDKigMe3KHmsBlV0q2LBQ6TeJyZeVH4RtDO8b47ywDI4P1nW2EP2 tC1w== X-Received: by 10.43.90.199 with SMTP id bj7mr95122031icc.35.1426692363571; Wed, 18 Mar 2015 08:26:03 -0700 (PDT) Original-Received: from ?IPv6:2601:4:403:8500:28db:ec:783a:184b? ([2601:4:403:8500:28db:ec:783a:184b]) by mx.google.com with ESMTPSA id x2sm1894594igg.9.2015.03.18.08.26.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Mar 2015 08:26:02 -0700 (PDT) X-Mailer: Apple Mail (2.2070.6) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4001:c05::233 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:183993 Archived-At: I=E2=80=99ve often run into an issue when assuming `setq-local=E2=80=99 = behave like `setq=E2=80=99 by accepting multiple [SYM VAL] pairs and = returning the value assigned to the last symbol rather than only = accepting one symbol and one value. This is my patch that modifies `setq-local=E2=80=99 to behave this way. = Please advise on why this can or shouldn=E2=80=99t be applied. Note that I have not filled out the copyright assignment paperwork, so = if it is to be applied, please send send in the right direction to get = the paperwork taken care of. Thank You - Jordon Biondo diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d61a0a6..8154d60 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2015-03-18 Jordon Biondo + + * lisp/subr.el (setq-local): Can now set multiple local = variables + like `setq'. + 2015-03-18 Dima Kogan =20 Have gud-display-line not display source buffer in gud window. diff --git a/lisp/subr.el b/lisp/subr.el index deadca6..41340f0 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -116,10 +116,21 @@ BODY should be a list of Lisp expressions. ;; depend on backquote.el. (list 'function (cons 'lambda cdr))) =20 -(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. - (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)))) =20 (defmacro defvar-local (var val &optional docstring) "Define VAR as a buffer-local variable with default value VAL.