From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#39373: 27.0.50; [PATCH] mode-local-print-bindings broken with lexical-binding Date: Fri, 31 Jan 2020 21:51:48 +0100 Message-ID: <8EF7D3C6-041D-493F-859B-55D8D35AF588@acm.org> References: <495920D0-A298-43BF-99E6-B5ADA06113CB@acm.org> <83lfpnjuiz.fsf@gnu.org> <928DB820-6899-4653-8872-82CE3CF567CD@acm.org> <83imkrjrvh.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="63375"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 39373@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 31 21:52:20 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ixdH2-000GRY-Dp for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 31 Jan 2020 21:52:20 +0100 Original-Received: from localhost ([::1]:59446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixdGz-0007z1-Db for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 31 Jan 2020 15:52:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55214) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixdGl-0007xV-MJ for bug-gnu-emacs@gnu.org; Fri, 31 Jan 2020 15:52:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ixdGk-0003Bn-QO for bug-gnu-emacs@gnu.org; Fri, 31 Jan 2020 15:52:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60423) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ixdGk-0003BY-H4 for bug-gnu-emacs@gnu.org; Fri, 31 Jan 2020 15:52:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ixdGk-0005DE-FI for bug-gnu-emacs@gnu.org; Fri, 31 Jan 2020 15:52:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 31 Jan 2020 20:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39373 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 39373-submit@debbugs.gnu.org id=B39373.158050392020028 (code B ref 39373); Fri, 31 Jan 2020 20:52:02 +0000 Original-Received: (at 39373) by debbugs.gnu.org; 31 Jan 2020 20:52:00 +0000 Original-Received: from localhost ([127.0.0.1]:38163 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ixdGi-0005Cy-IJ for submit@debbugs.gnu.org; Fri, 31 Jan 2020 15:52:00 -0500 Original-Received: from mail1452c50.megamailservers.eu ([91.136.14.52]:48884 helo=mail266c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ixdGf-0005Ci-Ky for 39373@debbugs.gnu.org; Fri, 31 Jan 2020 15:51:58 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1580503910; bh=lLIiawQkyOfDQ44mDYjtG4+mx8tw54ABAfeIt57hgkU=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=epA63VZIsTiobJc3K5ksiVFjYt3wZ7xbSlsdEilXxF09/cO54H0NzgucUEno919SA 79H5463xR1zcctdYYJ+KM4em1JNi3k3vyzCeyNR9WVASGz0lMu56jfQ4E8+rComFf5 snBbrdcvnAUzKJbSLV5wOf136Vdbl0AH+AVFsXS4= Feedback-ID: mattiase@acm.or Original-Received: from stanniol.lan (c-6f4fe655.032-75-73746f71.bbcust.telenor.se [85.230.79.111]) (authenticated bits=0) by mail266c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 00VKpmNp000978; Fri, 31 Jan 2020 20:51:50 +0000 In-Reply-To: <83imkrjrvh.fsf@gnu.org> X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B020A.5E349366.0034, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=PNJxBsiC c=1 sm=1 tr=0 a=fHaj9vQUQVKQ4sUldAaXuQ==:117 a=fHaj9vQUQVKQ4sUldAaXuQ==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=mDV3o1hIAAAA:8 a=GumZ9bsJRw_c3x8tsY0A:9 a=CjuIK1q_8ugA:10 a=_FVE-zBwftR9WsbkzFJk:22 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:175529 Archived-At: 31 jan. 2020 kl. 21.25 skrev Eli Zaretskii : > That's not the "usual" way of fixing problems with lexical-binding, > and it isn't immediately clear to me why that fixes the problem. 'add-to-list' doesn't work on lexical variables because it's a plain = function taking the variable symbol as argument. 'push' works on lexical = variables since it is a macro that expands to direct variable reference = and setq. I should perhaps have included this in the commit message. Happily, Emacs provides generalised variable support for 'if' and = 'cons', so that they can be used as target for 'push'. We could sink the pushes to the leaves of the condition tree, if you = prefer: (cond ((get s 'mode-variable-flag) (if (get s 'constant-flag) (push s mc) (push s mv))) ((get s 'override-flag) (if (get s 'constant-flag) (push s fo) (push s ov))) (t (push s us))) Not as elegant or concise, but does not rely on if and cond as GVs in = push.