unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#70137: 30.0.50; pp-macroexpand-last-sexp buffers should turn lexical binding on
@ 2024-04-02  6:01 Augusto Stoffel
  2024-04-02 11:59 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Augusto Stoffel @ 2024-04-02  6:01 UTC (permalink / raw)
  To: 70137

If you call pp-macroexpand-last-sexp in a buffer with lexical binding,
the resulting *Pp Macroexpand Output* buffer has lexical binding turned
off.

The problem with this is that if you now go the *Pp Macroexpand Output*
buffer and call pp-macroexpand-last-sexp again, this second macro
expansion step may not reflect what would happen in the original buffer;
I don't recall an example, but some macros expand differently in the two
variable scoping modes.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#70137: 30.0.50; pp-macroexpand-last-sexp buffers should turn lexical binding on
  2024-04-02  6:01 bug#70137: 30.0.50; pp-macroexpand-last-sexp buffers should turn lexical binding on Augusto Stoffel
@ 2024-04-02 11:59 ` Eli Zaretskii
  2024-04-02 20:56 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-10 21:39 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2024-04-02 11:59 UTC (permalink / raw)
  To: Augusto Stoffel, Stefan Monnier; +Cc: 70137

> From: Augusto Stoffel <arstoffel@gmail.com>
> Date: Tue, 02 Apr 2024 08:01:18 +0200
> 
> If you call pp-macroexpand-last-sexp in a buffer with lexical binding,
> the resulting *Pp Macroexpand Output* buffer has lexical binding turned
> off.
> 
> The problem with this is that if you now go the *Pp Macroexpand Output*
> buffer and call pp-macroexpand-last-sexp again, this second macro
> expansion step may not reflect what would happen in the original buffer;
> I don't recall an example, but some macros expand differently in the two
> variable scoping modes.

Adding Stefan.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#70137: 30.0.50; pp-macroexpand-last-sexp buffers should turn lexical binding on
  2024-04-02  6:01 bug#70137: 30.0.50; pp-macroexpand-last-sexp buffers should turn lexical binding on Augusto Stoffel
  2024-04-02 11:59 ` Eli Zaretskii
@ 2024-04-02 20:56 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-10 21:39 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-04-02 20:56 UTC (permalink / raw)
  To: Augusto Stoffel; +Cc: 70137

Augusto Stoffel <arstoffel@gmail.com> writes:

> If you call pp-macroexpand-last-sexp in a buffer with lexical binding,
> the resulting *Pp Macroexpand Output* buffer has lexical binding turned
> off.

Same as with any other displayed pp output buffer btw, or any temp
buffer.  All inherit the global lexical-binding -> nil binding.  Not
ideal indeed.

Michael.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#70137: 30.0.50; pp-macroexpand-last-sexp buffers should turn lexical binding on
  2024-04-02  6:01 bug#70137: 30.0.50; pp-macroexpand-last-sexp buffers should turn lexical binding on Augusto Stoffel
  2024-04-02 11:59 ` Eli Zaretskii
  2024-04-02 20:56 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-04-10 21:39 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-04-10 21:39 UTC (permalink / raw)
  To: Augusto Stoffel; +Cc: 70137

> If you call pp-macroexpand-last-sexp in a buffer with lexical binding,
> the resulting *Pp Macroexpand Output* buffer has lexical binding turned off.
>
> The problem with this is that if you now go the *Pp Macroexpand Output*
> buffer and call pp-macroexpand-last-sexp again, this second macro
> expansion step may not reflect what would happen in the original buffer;
> I don't recall an example, but some macros expand differently in the two
> variable scoping modes.

Indeed.  `dolist` and `dotimes` were such examples (tho nowadays they
return the same result).  Most other examples I can think of signal
an error when used without lexical binding.  There are a few more subtle
examples where the macro tests `macroexp--dynamic-variable-p`.

Do you happen to have a patch to propagate the value of
`lexical-binding` to the new buffer?


        Stefan






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-10 21:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-02  6:01 bug#70137: 30.0.50; pp-macroexpand-last-sexp buffers should turn lexical binding on Augusto Stoffel
2024-04-02 11:59 ` Eli Zaretskii
2024-04-02 20:56 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-10 21:39 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).