[latex3-commits] [git/LaTeX3-latex3-latex2e] lthooks: updated version of lthooks (1b04c2bf)
Frank Mittelbach
frank.mittelbach at latex-project.org
Mon Jul 13 15:55:23 CEST 2020
Repository : https://github.com/latex3/latex2e
On branch : lthooks
Link : https://github.com/latex3/latex2e/commit/1b04c2bfe89ae54d696d9b2c6cdb2d6b94b3e8ed
>---------------------------------------------------------------
commit 1b04c2bfe89ae54d696d9b2c6cdb2d6b94b3e8ed
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Mon Jul 13 15:55:23 2020 +0200
updated version of lthooks
>---------------------------------------------------------------
1b04c2bfe89ae54d696d9b2c6cdb2d6b94b3e8ed
base/lthooks.dtx | 40 ++++++++++++++++++++++++++++++----------
1 file changed, 30 insertions(+), 10 deletions(-)
diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 783f644d..e554a827 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -17,8 +17,8 @@
% for those people who are interested or want to report an issue.
%
% \begin{macrocode}
-\providecommand\lthooksversion{v0.8u}
-\providecommand\lthooksdate{2020/07/11}
+\providecommand\lthooksversion{v0.8v}
+\providecommand\lthooksdate{2020/07/13}
% \end{macrocode}
%
%<*driver>
@@ -1268,10 +1268,10 @@
%
% \subsection{Debugging}
%
-% \begin{macro}{\l_@@_debug_bool}
+% \begin{macro}{\g_@@_debug_bool}
% Holds the current debugging state.
% \begin{macrocode}
-\bool_new:N \l_@@_debug_bool
+\bool_new:N \g_@@_debug_bool
% \end{macrocode}
% \end{macro}
%
@@ -1283,18 +1283,18 @@
\cs_new_eq:NN \@@_debug:n \use_none:n
\cs_new_protected:Npn \hook_debug_on:
{
- \bool_set_true:N \l_@@_debug_bool
+ \bool_gset_true:N \g_@@_debug_bool
\@@_debug_gset:
}
\cs_new_protected:Npn \hook_debug_off:
{
- \bool_set_false:N \l_@@_debug_bool
+ \bool_gset_false:N \g_@@_debug_bool
\@@_debug_gset:
}
\cs_new_protected:Npn \@@_debug_gset:
{
\cs_gset_protected:Npx \@@_debug:n ##1
- { \bool_if:NT \l_@@_debug_bool {##1} }
+ { \bool_if:NT \g_@@_debug_bool {##1} }
}
% \end{macrocode}
% \end{macro}
@@ -3110,10 +3110,30 @@
% default label for the top-level. Since the string \verb|top-level|
% is hardcoded, here this item of the stack is empty. Also, since
% we're in an input level, add \verb|lthooks| to the stack as well.
-% This stack should never go empty.
+% This stack should never go empty, so we loop through \LaTeXe's
+% file name stack, and add empty entries to \cs{g_@@_name_stack_seq}
+% for each item in that stack. The last item is the \verb|top-level|,
+% which also gets an empty entry.
+%
+% Also check for the case we're loading \texttt{lthooks} in the
+% \LaTeXe{} kernel. In that case, \cs{@currname} isn't \verb|lthooks|
+% and just the top-level is added to the stack as an empty entry.
% \begin{macrocode}
-\seq_gpush:Nn \g_@@_name_stack_seq { }
-\seq_gpush:Nn \g_@@_name_stack_seq { lthooks }
+\str_if_eq:VnTF \@currname { lthooks }
+ {
+ \seq_gpush:Nn \g_@@_name_stack_seq { lthooks }
+ \cs_set_protected:Npn \@@_tmp:w #1 #2 #3
+ {
+ \quark_if_recursion_tail_stop:n {#1}
+ \seq_gput_right:Nn \g_@@_name_stack_seq { }
+ \@@_tmp:w
+ }
+ \exp_after:wN \@@_tmp:w
+ \@currnamestack
+ \q_recursion_tail \q_recursion_tail
+ \q_recursion_tail \q_recursion_stop
+ }
+ { \seq_gpush:Nn \g_@@_name_stack_seq { } }
% \end{macrocode}
%
% Two commands keep track of the stack: when a file is input,
More information about the latex3-commits
mailing list.