[latex3-commits] [git/LaTeX3-latex3-latex2e] apdf161: Slight normalisation to \use_hook:n and optimise non-file hooks (b10b840b)
PhelypeOleinik
phelype.oleinik at latex-project.org
Tue Sep 8 02:45:41 CEST 2020
Repository : https://github.com/latex3/latex2e
On branch : apdf161
Link : https://github.com/latex3/latex2e/commit/b10b840bf03cef2c89d7d70403c787c13c4a6b8e
>---------------------------------------------------------------
commit b10b840bf03cef2c89d7d70403c787c13c4a6b8e
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Mon Sep 7 21:45:41 2020 -0300
Slight normalisation to \use_hook:n and optimise non-file hooks
from BLF
>---------------------------------------------------------------
b10b840bf03cef2c89d7d70403c787c13c4a6b8e
base/lthooks.dtx | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 741fd5f2..302bfdef 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -3383,6 +3383,7 @@
%
% \begin{macro}{\hook_use:n}
% \begin{macro}[EXP]{\@@_use_initialized:n}
+% \begin{macro}{\@@_use:n,\@@_preamble_use:n,\@@_use_undefined:nw}
% \begin{macro}{\@@_preamble_hook:n}
% \cs{hook_use:n} as defined here is used in the preamble, where
% hooks aren't initialized by default. \cs{@@_use_initialized:n} is
@@ -3409,6 +3410,8 @@
% careful to avoid this.
% \begin{macrocode}
\cs_new_protected:Npn \hook_use:n #1
+ { \tl_trim_spaces_apply:nN {#1} \@@_preamble_use:n }
+\cs_new_protected:Npn \@@_preamble_use:n #1
{
\tl_if_exist:cTF { g_@@_#1_code_tl }
{
@@ -3418,10 +3421,19 @@
{ \@@_use:wn #1 / \s_@@_mark {#1} }
}
\cs_new:Npn \@@_use_initialized:n #1
+ { \tl_trim_spaces_apply:nN {#1} \@@_use:n }
+\cs_new:Npn \@@_use:n #1
{
- \tl_if_exist:cTF { g_@@_#1_code_tl }
- { \cs:w g_@@_#1_code_tl \cs_end: }
- { \@@_use:wn #1 / \s_@@_mark {#1} }
+ \if_cs_exist:w g_@@_#1_code_tl \cs_end:
+ \cs:w g_@@_#1_code_tl \exp_after:wN \cs_end:
+ \else:
+ \@@_use_undefined:nw {#1}
+ \fi:
+ }
+\cs_new:Npn \@@_use_undefined:nw #1 #2
+ {
+ #2 % fi
+ \@@_use:wn #1 / \s_@@_mark {#1}
}
\cs_new_protected:Npn \@@_preamble_hook:n #1
{ \@@_initialize_hook_code:n {#1} }
@@ -3429,6 +3441,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}[EXP]{\@@_use:wn}
% \begin{macro}{\@@_try_file_hook:n,\@@_if_exist_use:n}
@@ -3485,7 +3498,7 @@
\tl_if_exist:cT { g_@@_#1_code_tl }
{
\prop_gput:Nnn \g_@@_execute_immediately_prop {#1} { }
- \hook_use:n {#1}
+ \@@_use:n {#1}
}
}
% \end{macrocode}
More information about the latex3-commits
mailing list.