From: Pip Cet <pipcet@gmail.com>
To: Joseph Mingrone <jrm@ftfl.ca>
Cc: Mattias <mattiase@acm.org>, Lars Ingebrigtsen <larsi@gnus.org>,
Vitalie Spinu <spinuvit@gmail.com>,
46912@debbugs.gnu.org
Subject: bug#46912: 28.0.50; Byte compiled defvar with lexical binding throws (void-variable foo)
Date: Fri, 5 Mar 2021 02:52:39 +0000 [thread overview]
Message-ID: <CAOqdjBc2MgtaSGRzRX__p7Q-j38WD=3cEp=_0tZFLCOJj2cO_g@mail.gmail.com> (raw)
In-Reply-To: <868s721pf4.fsf@phe.ftfl.ca>
[-- Attachment #1: Type: text/plain, Size: 253 bytes --]
On Thu, Mar 4, 2021 at 11:15 PM Joseph Mingrone <jrm@ftfl.ca> wrote:
> With this patch applied to 20596a5, I still see the problems Vitalie
> reported.
Strange, I don't see how I managed to convince myself it works here.
Anyway, this should work.
Pip
[-- Attachment #2: 0001-Don-t-ignore-lexically-bound-variables-in-a-defvar-b.patch --]
[-- Type: text/x-patch, Size: 1286 bytes --]
From 09a195ed2ed7004c54d1701d0017a4fb10f6cbce Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@gmail.com>
Date: Thu, 4 Mar 2021 21:06:13 +0000
Subject: [PATCH] Don't ignore lexically-bound variables in a defvar
(bug#46912)
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Walk
the value form of a defvar.
---
lisp/emacs-lisp/byte-opt.el | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index b51ba801552d6..b3325816c5c97 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -607,9 +607,12 @@ byte-optimize-form-code-walker
(setq args (cddr args)))
(cons fn (nreverse var-expr-list))))
- (`(defvar ,(and (pred symbolp) name) . ,_)
- (push name byte-optimize--dynamic-vars)
- form)
+ (`(defvar ,(and (pred symbolp) name) . ,rest)
+ (let ((optimized-rest (and rest
+ (cons (byte-optimize-form (car rest) nil)
+ (cdr rest)))))
+ (push name byte-optimize--dynamic-vars)
+ `(defvar ,name . ,optimized-rest)))
(`(,(pred byte-code-function-p) . ,exps)
(cons fn (mapcar #'byte-optimize-form exps)))
--
2.30.1
next prev parent reply other threads:[~2021-03-05 2:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-04 0:14 bug#46912: 28.0.50; Byte compiled defvar with lexical binding throws (void-variable foo) Vitalie Spinu
2021-03-04 18:03 ` Joseph Mingrone
2021-03-04 20:09 ` Lars Ingebrigtsen
2021-03-04 20:17 ` Joseph Mingrone
2021-03-04 20:48 ` Lars Ingebrigtsen
2021-03-04 21:08 ` Pip Cet
2021-03-04 23:15 ` Joseph Mingrone
2021-03-05 2:52 ` Pip Cet [this message]
2021-03-05 3:22 ` Joseph Mingrone
2021-03-05 8:27 ` Vitalie Spinu
2021-03-05 9:10 ` Mattias Engdegård
2021-03-05 9:56 ` Pip Cet
2021-03-04 20:21 ` Pip Cet
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOqdjBc2MgtaSGRzRX__p7Q-j38WD=3cEp=_0tZFLCOJj2cO_g@mail.gmail.com' \
--to=pipcet@gmail.com \
--cc=46912@debbugs.gnu.org \
--cc=jrm@ftfl.ca \
--cc=larsi@gnus.org \
--cc=mattiase@acm.org \
--cc=spinuvit@gmail.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).