From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Alan Mackenzie <acm@muc.de>
Cc: 73746@debbugs.gnu.org,
"Mattias Engdegård" <mattias.engdegard@gmail.com>,
73725@debbugs.gnu.org
Subject: bug#73725: Master: Wrong position for byte compiler warning message.
Date: Wed, 23 Oct 2024 09:27:12 -0400 [thread overview]
Message-ID: <jwva5ev0xn6.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <ZxjcbhlkHhE2_-Dn@MAC.fritz.box> (Alan Mackenzie's message of "Wed, 23 Oct 2024 11:22:22 +0000")
LGTM. Further nitpicks below,
Stefan
> diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
> index d8dbfa62bf9..5cfc3528492 100644
> --- a/lisp/emacs-lisp/byte-opt.el
> +++ b/lisp/emacs-lisp/byte-opt.el
> @@ -509,8 +509,12 @@ byte-optimize-one-form
> (defun byte-optimize-form (form &optional for-effect)
> (while
> (progn
> - ;; First, optimize all sub-forms of this one.
> - (setq form (byte-optimize-form-code-walker form for-effect))
> + ;; First, optimize all sub-forms of this one. Note that
> + ;; `byte-optimize-form-code-walker' sometimes changes the car of
> + ;; `form', hence the `macroexp-preserve-posification'.
> + (setq form
> + (macroexp-preserve-posification
> + form (byte-optimize-form-code-walker form for-effect)))
We know it can change the `car`, that's not the question I think the
comment should answer. The comment should instead explain why
`byte-optimize-form-code-walker` doesn't use
`macroexp-preserve-posification` in those few places where it can change
the `car`s.
IIUC the answer is something like "because it was more work".
> @@ -524,7 +603,9 @@ macroexpand-all
> definitions to shadow the loaded ones for use in file byte-compilation."
> (let ((macroexpand-all-environment environment)
> (macroexp--dynvars macroexp--dynvars))
> - (macroexp--expand-all form)))
> + (macroexp-preserve-posification
> + form
> + (macroexp--expand-all form))))
I missed this one earlier: why do we need this one?
Doesn't `macroexp--expand-all` already take care of
preserving positions?
[ You don't need to answer here: better answer in the code 🙂 ]
Stefan
next prev parent reply other threads:[~2024-10-23 13:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-10 10:22 bug#73725: Master: Wrong position for byte compiler warning message Alan Mackenzie
2024-10-11 23:45 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-12 10:47 ` Alan Mackenzie
2024-10-12 13:53 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-12 12:01 ` Mattias Engdegård
2024-10-20 14:13 ` Alan Mackenzie
2024-10-20 15:06 ` Mattias Engdegård
2024-10-20 15:38 ` bug#73746: " Alan Mackenzie
2024-10-20 16:35 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-22 12:48 ` Alan Mackenzie
2024-10-22 13:33 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-22 21:19 ` Alan Mackenzie
2024-10-23 13:30 ` bug#73746: " Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-23 11:22 ` Alan Mackenzie
2024-10-23 13:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-10-23 17:44 ` Alan Mackenzie
2024-10-23 17:49 ` Mattias Engdegård
2024-10-23 19:03 ` Alan Mackenzie
2024-10-13 15:31 ` 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=jwva5ev0xn6.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=73725@debbugs.gnu.org \
--cc=73746@debbugs.gnu.org \
--cc=acm@muc.de \
--cc=mattias.engdegard@gmail.com \
--cc=monnier@iro.umontreal.ca \
/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).