[latex3-commits] [git/LaTeX3-latex3-latex3] earlier-expl3: Use a more robust reload test than \@pushfilenameaux (1d163360f)

PhelypeOleinik tex.phelype at gmail.com
Sat Jun 6 01:36:56 CEST 2020


Repository : https://github.com/latex3/latex3
On branch  : earlier-expl3
Link       : https://github.com/latex3/latex3/commit/1d163360f97a31f9491fa27e6a0393b30b0c17fc

>---------------------------------------------------------------

commit 1d163360f97a31f9491fa27e6a0393b30b0c17fc
Author: PhelypeOleinik <tex.phelype at gmail.com>
Date:   Fri Jun 5 20:36:56 2020 -0300

    Use a more robust reload test than \@pushfilenameaux
    
    Spoiler alert: the timing of its definition will change in the next few commits


>---------------------------------------------------------------

1d163360f97a31f9491fa27e6a0393b30b0c17fc
 l3kernel/expl3.dtx | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/l3kernel/expl3.dtx b/l3kernel/expl3.dtx
index 3c445d5fa..396c2f40e 100644
--- a/l3kernel/expl3.dtx
+++ b/l3kernel/expl3.dtx
@@ -1215,22 +1215,33 @@
 \fi
 %    \end{macrocode}
 %
-% If \pkg{expl3} was pre-loaded, we now have to deal with the fact that
-% the syntax will not be activated for the package mode version:
-% simply turn it on. We use \tn{@pushfilenameaux} as a marker: it's defined
-% a little later.
 %    \begin{macrocode}
-\ifdefined\@pushfilenameaux
-  \ExplSyntaxOn
-\fi
+%<@@=expl>
 %    \end{macrocode}
 %
+% Here we can also detect whether we're reloading.  This code goes into
+% \texttt{expl3.ltx} and \texttt{expl3.sty}, the former loaded into the
+% \LaTeXe{} format.  When this code is loaded for the first time, the
+% \cs{g_@@_reload_bool} boolean doesn't exist (\cs{else} branch of the
+% \cs{ifcsname} below), so we create it.  If the \cs{ifcsname} is true,
+% then we do \cs{ExplSyntaxOn} (because when reloading,
+% \texttt{expl3-code.tex} isn't read again), and set
+% \cs{g_@@_reload_bool} to true.
 %    \begin{macrocode}
-%<@@=expl>
+\ifcsname\detokenize{g_@@_reload_bool}\endcsname
+  \ExplSyntaxOn
+  \bool_gset_true:N \g_@@_reload_bool
+\else
+  \bool_new:N \g_@@_reload_bool
+\fi
 %    \end{macrocode}
 %
 % \begin{variable}{\c_@@_def_ext_tl}
-%   Needed by \LaTeXe{}, and avoiding a re-load issue.
+%   Needed by \LaTeXe{}, and avoiding a re-load issue.  Variables are
+%   best checked explicitly, rather than with \cs{g_@@_reload_bool}
+%   because some appear only in one of the code files, so
+%   \cs{g_@@_reload_bool} doesn't necessarily mean that the variable
+%   is already declared.
 %    \begin{macrocode}
 \cs_if_exist:NF \c_@@_def_ext_tl
   { \tl_const:Nn \c_@@_def_ext_tl { def } }
@@ -1332,11 +1343,9 @@
 %</!2ekernel>
 %    \end{macrocode}
 %
-% A test for pre-loading: does \tn{@pushfilenameaux} already exist.
-% The alrady-loaded mechanism will handle everything now.
 %    \begin{macrocode}
 %<*!2ekernel>
-\cs_if_exist:NT \@pushfilenameaux
+\bool_if:NT \g_@@_reload_bool
   {
     \cs_gset_eq:NN \__kernel_sys_configuration_load:n
       \__kernel_sys_configuration_load_std:n





More information about the latex3-commits mailing list.