aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2025-05-03 16:26:44 +0300
committerEli Zaretskii2025-05-03 16:26:44 +0300
commit8a097aede53dfb8f595d79824c784c188b210093 (patch)
tree89ef932c40dcf09ce58bb24421fa4fb19e22de58 /src
parent61de658827bef91cd32d992ff28a3b0d320aaf24 (diff)
downloademacs-8a097aede53dfb8f595d79824c784c188b210093.tar.gz
emacs-8a097aede53dfb8f595d79824c784c188b210093.zip
Avoid warnings about 'lexical-binding' in 'eval-buffer'
* src/lread.c (Feval_buffer): Don't emit a lexbind warning if the buffer already has a local value of 'lexical-binding'. Doc fix. (Bug#77883)
Diffstat (limited to 'src')
-rw-r--r--src/lread.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/lread.c b/src/lread.c
index 5c8bbe7da9f..95c9e711130 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2589,11 +2589,14 @@ DO-ALLOW-PRINT, if non-nil, specifies that output functions in the
2589 evaluated code should work normally even if PRINTFLAG is nil, in 2589 evaluated code should work normally even if PRINTFLAG is nil, in
2590 which case the output is displayed in the echo area. 2590 which case the output is displayed in the echo area.
2591 2591
2592This function ignores the current value of the `lexical-binding' 2592This function ignores the global value of the `lexical-binding'
2593variable. Instead it will heed any 2593variable. Instead it will heed the buffer-local value of that
2594variable and any
2594 -*- lexical-binding: t -*- 2595 -*- lexical-binding: t -*-
2595settings in the buffer, and if there is no such setting, the buffer 2596settings in the buffer; if there is no such setting, and the
2596will be evaluated without lexical binding. 2597buffer-local value of the variable is nil, the buffer will be
2598evaluated with the value of `lexical binding' equal to its
2599top-level default value, as returned by `default-toplevel-value'.
2597 2600
2598This function preserves the position of point. */) 2601This function preserves the position of point. */)
2599 (Lisp_Object buffer, Lisp_Object printflag, Lisp_Object filename, 2602 (Lisp_Object buffer, Lisp_Object printflag, Lisp_Object filename,
@@ -2621,7 +2624,10 @@ This function preserves the position of point. */)
2621 specbind (Qstandard_output, tem); 2624 specbind (Qstandard_output, tem);
2622 record_unwind_protect_excursion (); 2625 record_unwind_protect_excursion ();
2623 BUF_TEMP_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf))); 2626 BUF_TEMP_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf)));
2624 specbind (Qlexical_binding, get_lexical_binding (buf, buf)); 2627 /* Don't emit a warning about 'lexical-binding' if it already has a
2628 local binding in the buffer. */
2629 if (NILP (Flocal_variable_p (Qlexical_binding, buf)))
2630 specbind (Qlexical_binding, get_lexical_binding (buf, buf));
2625 BUF_TEMP_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf))); 2631 BUF_TEMP_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf)));
2626 readevalloop (buf, 0, filename, 2632 readevalloop (buf, 0, filename,
2627 !NILP (printflag), unibyte, Qnil, Qnil, Qnil); 2633 !NILP (printflag), unibyte, Qnil, Qnil, Qnil);