unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#65742: 30.0.50; default-toplevel-value and forwarded symbols
@ 2023-09-04 19:02 Gerd Möllmann
  2023-09-04 19:18 ` Eli Zaretskii
  2023-09-04 19:24 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 4+ messages in thread
From: Gerd Möllmann @ 2023-09-04 19:02 UTC (permalink / raw)
  To: 65742

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

Function default-toplevel-value does not take let-bindings for forwarded
symbols into account.

(progn
  (defvar my-var nil)
  (setq my-var t)
  (let ((my-var :let))
    (default-toplevel-value 'my-var)))
=> t

(progn
  (setq lexical-binding t)
  (let ((lexical-binding :let))
    (default-toplevel-value 'lexical-binding)))
=> nil


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch --]
[-- Type: text/x-patch, Size: 695 bytes --]

From d6cd84bcd1bb86d32d49e660d4041f655bf295f1 Mon Sep 17 00:00:00 2001
From: Gerd Moellmann <gerd.moellmann@gmail.com>
Date: Mon, 4 Sep 2023 20:48:28 +0200
Subject: [PATCH] default-toplevel-value nor working for forwarded syms

* src/eval.c (default_toplevel_binding): Handle SPECPDL_LET_LOCAL.
---
 src/eval.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/eval.c b/src/eval.c
index 9268b65aa85..59055a75782 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -664,6 +664,7 @@ default_toplevel_binding (Lisp_Object symbol)
     {
       switch ((--pdl)->kind)
 	{
+	case SPECPDL_LET_LOCAL:
 	case SPECPDL_LET_DEFAULT:
 	case SPECPDL_LET:
 	  if (EQ (specpdl_symbol (pdl), symbol))
-- 
2.42.0


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

* bug#65742: 30.0.50; default-toplevel-value and forwarded symbols
  2023-09-04 19:02 bug#65742: 30.0.50; default-toplevel-value and forwarded symbols Gerd Möllmann
@ 2023-09-04 19:18 ` Eli Zaretskii
  2023-09-04 19:24 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2023-09-04 19:18 UTC (permalink / raw)
  To: Gerd Möllmann, Stefan Monnier; +Cc: 65742

> From: Gerd Möllmann <gerd.moellmann@gmail.com>
> Date: Mon, 04 Sep 2023 21:02:59 +0200
> 
> Function default-toplevel-value does not take let-bindings for forwarded
> symbols into account.
> 
> (progn
>   (defvar my-var nil)
>   (setq my-var t)
>   (let ((my-var :let))
>     (default-toplevel-value 'my-var)))
> => t
> 
> (progn
>   (setq lexical-binding t)
>   (let ((lexical-binding :let))
>     (default-toplevel-value 'lexical-binding)))
> => nil
> 
> >From d6cd84bcd1bb86d32d49e660d4041f655bf295f1 Mon Sep 17 00:00:00 2001
> From: Gerd Moellmann <gerd.moellmann@gmail.com>
> Date: Mon, 4 Sep 2023 20:48:28 +0200
> Subject: [PATCH] default-toplevel-value nor working for forwarded syms
> 
> * src/eval.c (default_toplevel_binding): Handle SPECPDL_LET_LOCAL.
> ---
>  src/eval.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/eval.c b/src/eval.c
> index 9268b65aa85..59055a75782 100644
> --- a/src/eval.c
> +++ b/src/eval.c
> @@ -664,6 +664,7 @@ default_toplevel_binding (Lisp_Object symbol)
>      {
>        switch ((--pdl)->kind)
>  	{
> +	case SPECPDL_LET_LOCAL:
>  	case SPECPDL_LET_DEFAULT:
>  	case SPECPDL_LET:
>  	  if (EQ (specpdl_symbol (pdl), symbol))
> -- 
> 2.42.0

Adding Stefan.





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

* bug#65742: 30.0.50; default-toplevel-value and forwarded symbols
  2023-09-04 19:02 bug#65742: 30.0.50; default-toplevel-value and forwarded symbols Gerd Möllmann
  2023-09-04 19:18 ` Eli Zaretskii
@ 2023-09-04 19:24 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-04 19:55   ` Gerd Möllmann
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-04 19:24 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: 65742

> Function default-toplevel-value does not take let-bindings for forwarded
> symbols into account.
>
> (progn
>   (defvar my-var nil)
>   (setq my-var t)
>   (let ((my-var :let))
>     (default-toplevel-value 'my-var)))
> => t
>
> (progn
>   (setq lexical-binding t)
>   (let ((lexical-binding :let))
>     (default-toplevel-value 'lexical-binding)))
> => nil

Looks right to me: `lexical-binding` is set buffer-locally by the
`setq`, so the global/toplevel value is not affected.


        Stefan






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

* bug#65742: 30.0.50; default-toplevel-value and forwarded symbols
  2023-09-04 19:24 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-04 19:55   ` Gerd Möllmann
  0 siblings, 0 replies; 4+ messages in thread
From: Gerd Möllmann @ 2023-09-04 19:55 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 65742

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Function default-toplevel-value does not take let-bindings for forwarded
>> symbols into account.
>>
>> (progn
>>   (defvar my-var nil)
>>   (setq my-var t)
>>   (let ((my-var :let))
>>     (default-toplevel-value 'my-var)))
>> => t
>>
>> (progn
>>   (setq lexical-binding t)
>>   (let ((lexical-binding :let))
>>     (default-toplevel-value 'lexical-binding)))
>> => nil
>
> Looks right to me: `lexical-binding` is set buffer-locally by the
> `setq`, so the global/toplevel value is not affected.

Right, I forgot the setq.  How embarrasing.  Closing.





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

end of thread, other threads:[~2023-09-04 19:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-04 19:02 bug#65742: 30.0.50; default-toplevel-value and forwarded symbols Gerd Möllmann
2023-09-04 19:18 ` Eli Zaretskii
2023-09-04 19:24 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-04 19:55   ` Gerd Möllmann

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