aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2025-02-18 15:37:50 -0500
committerStefan Monnier2025-02-18 15:37:50 -0500
commitd685d21e8ae0cee566420d4dd68586f018b2ce0b (patch)
tree0b1ffc46884ea4d591639fdac3d03344a69d9037 /src
parent790c2f7c1c8c947b286c09525fc5a0425004a1f6 (diff)
downloademacs-d685d21e8ae0cee566420d4dd68586f018b2ce0b.tar.gz
emacs-d685d21e8ae0cee566420d4dd68586f018b2ce0b.zip
(lexical-binding): Allow changing the default value (bug#74145)
* lisp/loadup.el: Preserve (default-toplevel-value 'lexical-binding). * src/lread.c (Fload, Feval_buffer): Obey (default-toplevel-value 'lexical-binding). * doc/lispintro/emacs-lisp-intro.texi (Lexical vs Dynamic Binding Example): Use the lexical dialect also for the dynamic scoping example. * doc/lispref/edebug.texi (Edebug Eval): Remove long-obsolete mention of Edebug support for `lexical-let`.
Diffstat (limited to 'src')
-rw-r--r--src/lread.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lread.c b/src/lread.c
index 46c705e5c76..df1caaf5732 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1720,8 +1720,11 @@ Return t if the file exists and loads successfully. */)
1720 } 1720 }
1721 else 1721 else
1722 { 1722 {
1723 if (lisp_file_lexical_cookie (Qget_file_char) == Cookie_Lex) 1723 lexical_cookie_t lexc = lisp_file_lexical_cookie (Qget_file_char);
1724 Fset (Qlexical_binding, Qt); 1724 Fset (Qlexical_binding,
1725 (lexc == Cookie_Lex ? Qt
1726 : lexc == Cookie_Dyn ? Qnil
1727 : Fdefault_toplevel_value (Qlexical_binding)));
1725 1728
1726 if (! version || version >= 22) 1729 if (! version || version >= 22)
1727 readevalloop (Qget_file_char, &input, hist_file_name, 1730 readevalloop (Qget_file_char, &input, hist_file_name,
@@ -2606,8 +2609,11 @@ This function preserves the position of point. */)
2606 specbind (Qstandard_output, tem); 2609 specbind (Qstandard_output, tem);
2607 record_unwind_protect_excursion (); 2610 record_unwind_protect_excursion ();
2608 BUF_TEMP_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf))); 2611 BUF_TEMP_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf)));
2612 lexical_cookie_t lexc = lisp_file_lexical_cookie (buf);
2609 specbind (Qlexical_binding, 2613 specbind (Qlexical_binding,
2610 lisp_file_lexical_cookie (buf) == Cookie_Lex ? Qt : Qnil); 2614 lexc == Cookie_Lex ? Qt
2615 : lexc == Cookie_Dyn ? Qnil
2616 : Fdefault_toplevel_value (Qlexical_binding));
2611 BUF_TEMP_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf))); 2617 BUF_TEMP_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf)));
2612 readevalloop (buf, 0, filename, 2618 readevalloop (buf, 0, filename,
2613 !NILP (printflag), unibyte, Qnil, Qnil, Qnil); 2619 !NILP (printflag), unibyte, Qnil, Qnil, Qnil);