unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>, Mattias <mattiase@acm.org>
Cc: Joseph Mingrone <jrm@ftfl.ca>,
	46912@debbugs.gnu.org, Vitalie Spinu <spinuvit@gmail.com>
Subject: bug#46912: 28.0.50; Byte compiled defvar with lexical binding throws (void-variable foo)
Date: Thu, 4 Mar 2021 21:08:13 +0000	[thread overview]
Message-ID: <CAOqdjBdtC2vQTPyu9j05jmi8V7VtJYbdDJqPNM_NdW0V8cvRdw@mail.gmail.com> (raw)
In-Reply-To: <87y2f2sl0w.fsf_-_@gnus.org>

[-- Attachment #1: Type: text/plain, Size: 968 bytes --]

On Thu, Mar 4, 2021 at 8:48 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:
> Joseph Mingrone <jrm@ftfl.ca> writes:
> > I think the problem was introduced before 9b4a2dd (2021-02-14).  That
> > was the last snapshot that I was running and I'm pretty sure I saw the
> > problem then.  If I can find time tonight, I'll try to confirm that.
>
> Great; bisecting this would be very helpful.

Absolutely.

> Pip Cet <pipcet@gmail.com> writes:
>
> > I can reproduce it, three, but I can also reproduce it with the change
> > I think you're referring to reverted.
>
> Sorry about that; it was a stab in the dark using the "the one who
> touched it last" principle.  :-/

Not a problem at all. In fact, I've taken a look and it seems
byte-optimize-form-code-walker simply ignores the value form in a
defvar now..

So I suspect it's commit 83983b6b7a115474572973b62eb5e42251713e63, I'm
cc'ing Mattias, and I suspect this patch might help (but I've only
done one quick test).

Pip

[-- Attachment #2: 0001-Don-t-ignore-lexically-bound-variables-in-a-defvar-b.patch --]
[-- Type: text/x-patch, Size: 974 bytes --]

From c39ecf1c053f551a4b384d2ad2994fe0e58d67b0 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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index b51ba801552d6..ba2165a5d59ce 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -607,7 +607,9 @@ byte-optimize-form-code-walker
            (setq args (cddr args)))
          (cons fn (nreverse var-expr-list))))
 
-      (`(defvar ,(and (pred symbolp) name) . ,_)
+      (`(defvar ,(and (pred symbolp) name) . ,rest)
+       (when rest
+         (byte-optimize-form (car rest) nil))
        (push name byte-optimize--dynamic-vars)
        form)
 
-- 
2.30.1


  reply	other threads:[~2021-03-04 21:08 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 [this message]
2021-03-04 23:15           ` Joseph Mingrone
2021-03-05  2:52             ` Pip Cet
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=CAOqdjBdtC2vQTPyu9j05jmi8V7VtJYbdDJqPNM_NdW0V8cvRdw@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).