[latex3-commits] [git/LaTeX3-latex3-latex2e] hook-args: ... but only when doing \@@_initialize_all: (79e7faaa)
PhelypeOleinik
phelype.oleinik at latex-project.org
Fri Mar 10 03:48:03 CET 2023
Repository : https://github.com/latex3/latex2e
On branch : hook-args
Link : https://github.com/latex3/latex2e/commit/79e7faaa1cfb9b3d3f0c7608b2291fd1bc21ee1c
>---------------------------------------------------------------
commit 79e7faaa1cfb9b3d3f0c7608b2291fd1bc21ee1c
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Thu Mar 9 23:48:03 2023 -0300
... but only when doing \@@_initialize_all:
Only one failing test left...
>---------------------------------------------------------------
79e7faaa1cfb9b3d3f0c7608b2291fd1bc21ee1c
base/lthooks.dtx | 45 ++++++++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 21 deletions(-)
diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 1877dec8..27083a31 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -4410,42 +4410,49 @@
% update the fast execution token lists to hold the necessary code
% in the right order.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_initialize_all: {
+\cs_new_protected:Npn \@@_initialize_all:
+ {
% \end{macrocode}
% First we change \cs{@@_update_hook_code:n} which so far was a
% no-op to now initialize one hook. This way any later updates to
% the hook will run that code and also update the execution token
% list.
% \begin{macrocode}
- \cs_gset_eq:NN \@@_update_hook_code:n \@@_initialize_hook_code:n
+ \cs_gset_eq:NN \@@_update_hook_code:n \@@_initialize_hook_code:n
% \end{macrocode}
% Now we loop over all hooks that have been defined and update each
% of them.
% \begin{macrocode}
- \@@_debug:n { \prop_gclear:N \g_@@_used_prop }
- \seq_map_inline:Nn \g_@@_all_seq
- { \@@_update_hook_code:n {##1} }
+ \@@_debug:n { \prop_gclear:N \g_@@_used_prop }
+ \seq_map_inline:Nn \g_@@_all_seq
+ {
+ \tl_if_empty:cTF { c_@@_##1_parameter_tl }
+ { \@@_replacing_args_false: }
+ { \@@_replacing_args_true: }
+ \@@_update_hook_code:n {##1}
+ }
+ \@@_replacing_args_unset:
% \end{macrocode}
% If we are debugging we show results hook by hook for all hooks
% that have data.
% \begin{macrocode}
- \@@_debug:n
- {
- \iow_term:x{^^JAll~ initialized~ (non-empty)~ hooks:}
- \prop_map_inline:Nn \g_@@_used_prop
- {
- \iow_term:x
- { ^^J ~ ##1 ~ -> ~ \cs_replacement_spec:c { @@~##1 } ~ }
- }
- }
+ \@@_debug:n
+ {
+ \iow_term:x{^^JAll~ initialized~ (non-empty)~ hooks:}
+ \prop_map_inline:Nn \g_@@_used_prop
+ {
+ \iow_term:x
+ { ^^J ~ ##1 ~ -> ~ \cs_replacement_spec:c { @@~##1 } ~ }
+ }
+ }
% \end{macrocode}
% After all hooks are initialized we change the ``use'' to just
% call the hook code and not initialize it (as it was done in the
% preamble.
% \begin{macrocode}
- \cs_gset_eq:NN \hook_use:n \@@_use_initialized:n
- \cs_gset_eq:NN \@@_preamble_hook:n \use_none:n
-}
+ \cs_gset_eq:NN \hook_use:n \@@_use_initialized:n
+ \cs_gset_eq:NN \@@_preamble_hook:n \use_none:n
+ }
% \end{macrocode}
% \end{macro}
%
@@ -4460,9 +4467,6 @@
%<latexrelease> {Hooks~with~args}
\cs_new_protected:Npn \@@_initialize_hook_code:n #1
{
- \tl_if_empty:cTF { c_@@_#1_parameter_tl }
- { \@@_replacing_args_false: }
- { \@@_replacing_args_true: }
\@@_debug:n
{ \iow_term:x { ^^J Update~code~for~hook~'#1' \on at line :^^J } }
% \end{macrocode}
@@ -4530,7 +4534,6 @@
{ \exp_args:NNx \prop_gput:Nnn \g_@@_used_prop {#1} { } }
}
}
- \@@_replacing_args_unset:
}
%<latexrelease>\EndIncludeInRelease
% \end{macrocode}
More information about the latex3-commits
mailing list.