[latex3-commits] [latex3/latex3] main: Error if \sys_ensure_debug: is used in doc. body (f5f4b7348)
github at latex-project.org
github at latex-project.org
Mon Feb 19 21:47:23 CET 2024
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/f5f4b73488dfb599f5ede2542385da43b8a9c47a
>---------------------------------------------------------------
commit f5f4b73488dfb599f5ede2542385da43b8a9c47a
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Mon Feb 19 20:46:53 2024 +0000
Error if \sys_ensure_debug: is used in doc. body
See #1442.
>---------------------------------------------------------------
f5f4b73488dfb599f5ede2542385da43b8a9c47a
l3kernel/CHANGELOG.md | 1 +
l3kernel/l3msg.dtx | 6 ++++++
l3kernel/l3sys.dtx | 11 ++++++++++-
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 8a5a2f0cf..dbb2f1ffa 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -10,6 +10,7 @@ this project uses date-based 'snapshot' version identifiers.
### Fixed
- Restore `\__kernel_msg_...:nnx(xx)` for older `xparse` support
- Prevent an infinite loop in `\debug_(on|off):` (issue \#1442)
+- Require `\sys_ensure_backend:` is used in the preamble (issue \#1442)
## [2024-02-18]
diff --git a/l3kernel/l3msg.dtx b/l3kernel/l3msg.dtx
index d1ed62fcc..f1451727f 100644
--- a/l3kernel/l3msg.dtx
+++ b/l3kernel/l3msg.dtx
@@ -2322,6 +2322,12 @@
Run-time~backend~selection~may~only~be~carried~out~once~during~a~run.~
This~second~attempt~to~set~them~will~be~ignored.
}
+\msg_new:nnnn { sys } { load-debug-in-preamble }
+ { Load~debug~support~in~the~preamble. }
+ {
+ Debugging~requires~support~loaded~in~the~preamble: \\
+ Use~\sys_load_debug:~before~\begin{document}.
+ }
\msg_new:nnnn { sys } { wrong-backend }
{ Backend~request~inconsistent~with~engine:~using~'#2'~backend. }
{
diff --git a/l3kernel/l3sys.dtx b/l3kernel/l3sys.dtx
index 32de4338c..4662df727 100644
--- a/l3kernel/l3sys.dtx
+++ b/l3kernel/l3sys.dtx
@@ -691,7 +691,8 @@
% \end{variable}
%
% \begin{macro}{\sys_load_debug:}
-% Simple.
+% The most complicated thing here is that we can only use
+% \cs{__kernel_sys_configuration_load:n} in the preamble in \LaTeX{}.
% \begin{macrocode}
\cs_new_protected:Npn \sys_load_debug:
{
@@ -699,6 +700,14 @@
{ \__kernel_sys_configuration_load:n { l3debug } }
\bool_gset_true:N \g_@@_debug_bool
}
+\cs_if_exist:NT \@onefilewithoptions
+ {
+ \AtBeginDocument
+ {
+ \cs_gset_protected:Npn \sys_load_debug:
+ { \msg_error:nn { sys } { load-debug-in-preamble } }
+ }
+ }
% \end{macrocode}
% \end{macro}
%
More information about the latex3-commits
mailing list.