[latex3-commits] [git/LaTeX3-latex3-latex2e] hotfix/gh441: In reverse hooks, put the top-level chunk at the beginning (f0b01786)
PhelypeOleinik
phelype.oleinik at latex-project.org
Thu Dec 10 22:08:14 CET 2020
Repository : https://github.com/latex3/latex2e
On branch : hotfix/gh441
Link : https://github.com/latex3/latex2e/commit/f0b017864d5e0cefcca137b2ba4152d52e395240
>---------------------------------------------------------------
commit f0b017864d5e0cefcca137b2ba4152d52e395240
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Thu Dec 10 18:08:14 2020 -0300
In reverse hooks, put the top-level chunk at the beginning
>---------------------------------------------------------------
f0b017864d5e0cefcca137b2ba4152d52e395240
base/lthooks.dtx | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index f6de5408..abb8b190 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -2228,7 +2228,10 @@
\str_if_eq:nnTF {#2} { top-level }
{
\debug_suspend:
- \tl_gput_right:cn { @@_toplevel~#1 } {#3}
+ \@@_if_reversed:nTF {#1}
+ { \tl_gput_left:cn }
+ { \tl_gput_right:cn }
+ { @@_toplevel~#1 } {#3}
\debug_resume:
}
{
@@ -2877,9 +2880,9 @@
% in preparation is to change two definitions used later on.
% \begin{macrocode}
\@@_if_reversed:nTF {#1}
- { \cs_set_eq:NN \@@_tl_gput:NV \tl_gput_left:NV
+ { \cs_set_eq:NN \@@_tl_gput:Nn \tl_gput_left:Nn
\cs_set_eq:NN \@@_clist_gput:NV \clist_gput_left:NV }
- { \cs_set_eq:NN \@@_tl_gput:NV \tl_gput_right:NV
+ { \cs_set_eq:NN \@@_tl_gput:Nn \tl_gput_right:Nn
\cs_set_eq:NN \@@_clist_gput:NV \clist_gput_right:NV }
% \end{macrocode}
%
@@ -3075,7 +3078,7 @@
% \begin{macrocode}
\int_decr:N \l_@@_labels_int
\prop_get:NVN \l_@@_work_prop \l_@@_front_tl \l_@@_return_tl
- \@@_tl_gput:NV #1 \l_@@_return_tl
+ \exp_args:NNV \@@_tl_gput:Nn #1 \l_@@_return_tl
% \end{macrocode}
%
% \begin{macrocode}
@@ -3127,9 +3130,13 @@
% \end{macrocode}
% After we have added all hook code to \verb=#1= we finish it off
% with adding extra code for the |top-level| (\verb=#2=) and for one
-% time execution (\verb=#3=). These should normally be empty.
+% time execution (\verb=#3=). These should normally be empty. The
+% |top-level| code is added with \cs{@@_tl_gput:Nn} as that might
+% change for a reversed hook (then |top-level| is the very first code
+% chunk added). The |next| code is always added last.
% \begin{macrocode}
- \tl_gput_right:Nn #1 { #2 #3 }
+ \@@_tl_gput:Nn #1 {#2}
+ \tl_gput_right:Nn #1 {#3}
}
% \end{macrocode}
%
@@ -3140,13 +3147,13 @@
%
%
%
-% \begin{macro}{\@@_tl_gput:NV,\@@_clist_gput:NV}
+% \begin{macro}{\@@_tl_gput:Nn,\@@_clist_gput:NV}
% These append either on the right (normal hook) or on the left
% (reversed hook). This is setup up in
% \cs{@@_initialize_hook_code:n}, elsewhere their behavior is undefined.
% \begin{macrocode}
-\cs_new:Npn \@@_tl_gput:NV {\ERROR}
-\cs_new:Npn \@@_clist_gput:NV {\ERROR}
+\cs_new:Npn \@@_tl_gput:Nn { \ERROR }
+\cs_new:Npn \@@_clist_gput:NV { \ERROR }
% \end{macrocode}
% \end{macro}
%
More information about the latex3-commits
mailing list.