From: Alan Mackenzie <acm@muc.de>
To: 59057@debbugs.gnu.org
Subject: bug#59057: Emacs 29. Byte compiler sometimes forgets about a defvar.
Date: Sat, 5 Nov 2022 18:46:49 +0000 [thread overview]
Message-ID: <Y2avmeQhiTntL1q2@ACM> (raw)
Hello, Emacs.
With an up to date master version, start emacs -Q.
(i) Visit bug-compile-defvar.el, which looks like this:
#########################################################################
;; -*- lexical-binding: t -*-
(eval-and-compile
(defun version-check ()
(>= emacs-major-version 28)))
(defmacro acm-defvar (var)
`(eval-when-compile
; (when (version-check)
(defvar ,var)
(setq ,var emacs-major-version)
; )
))
(acm-defvar l-s-p)
(eval-when-compile
(message
"\nl-s-p is %sin byte-compile-bound-variables"
(if (memq 'l-s-p byte-compile-bound-variables)
"" "not "))
(message
"l-s-p is %sbound"
(if (boundp 'l-s-p) "" "not ")))
(defun acm-bind-l-s-p ()
(let ((l-s-p emacs-major-version))
(message "Nothing much\n")))
#########################################################################
The idea here is that the macro acm-defvar itself calls defvar, creating
a variable.
(ii) Do M-x byte-compile-file RET ~/bug-compile-defvar.el.
(iii) Note that this works properly, giving out the two messages, the
first of which confirms that the new variable l-s-p has been entered
into the list byte-compile-bound-variables.
(iv) Edit the buffer, removing both single semicolon comment markers, and
save the file.
(v) Do M-x byte-compile-file RET ~/bug-compile-defvar.el again.
(vi) Note that now the new variable is NOT in
byte-compile-bound-variables. This is a bug.
(vii) Note also that there is a spurious compiler warning about l-s-p
being an unused lexical variable in function acm-bind-l-s-p. This is
also a bug.
This bug doesn't occur on Emacs 28. I have a feeling it was introduced
into Emacs 29 very recently.
--
Alan Mackenzie (Nuremberg, Germany).
next reply other threads:[~2022-11-05 18:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-05 18:46 Alan Mackenzie [this message]
2022-11-07 13:07 ` bug#59057: Emacs 29. Byte compiler sometimes forgets about a defvar Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-07 20:20 ` Alan Mackenzie
2022-11-07 21:29 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-08 11:01 ` Alan Mackenzie
2022-11-08 14:12 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-07 21:31 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-09 13:40 ` Alan Mackenzie
2022-11-09 17:54 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-24 19:29 ` Stefan Kangas
2022-11-24 19:33 ` Eli Zaretskii
2022-11-24 20:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-24 21:12 ` Stefan Kangas
2022-11-25 10:36 ` Alan Mackenzie
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=Y2avmeQhiTntL1q2@ACM \
--to=acm@muc.de \
--cc=59057@debbugs.gnu.org \
/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).