From c8a8389b451ae31ce16dad7f82b0866b662c0fcc Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 8 Jan 2021 23:37:35 +0000
Subject: latex (9jan21)

git-svn-id: svn://tug.org/texlive/trunk@57354 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/latex/base/lthooks.dtx | 102 ++++++++++++++++++------
 1 file changed, 78 insertions(+), 24 deletions(-)

(limited to 'Master/texmf-dist/source/latex/base/lthooks.dtx')

diff --git a/Master/texmf-dist/source/latex/base/lthooks.dtx b/Master/texmf-dist/source/latex/base/lthooks.dtx
index cc79892ca77..0a04c38efbd 100644
--- a/Master/texmf-dist/source/latex/base/lthooks.dtx
+++ b/Master/texmf-dist/source/latex/base/lthooks.dtx
@@ -31,8 +31,8 @@
 %%% From File: lthooks.dtx
 %
 %    \begin{macrocode}
-\def\lthooksversion{v1.0g}
-\def\lthooksdate{2020/12/18}
+\def\lthooksversion{v1.0h}
+\def\lthooksdate{2021/01/07}
 %    \end{macrocode}
 %
 %<*driver>
@@ -1873,35 +1873,80 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\@@_tl_set:Nn,\@@_tl_set:cn,\@@_tl_set:cx}
-% \begin{macro}{\@@_tl_gset:Nn,\@@_tl_gset:cn,\@@_tl_gset:co,\@@_tl_gset:cx}
-% \begin{macro}{\@@_tl_gput_right:Nn,\@@_tl_gput_right:No,\@@_tl_gput_right:cn}
-% \begin{macro}{\@@_tl_gput_left:Nn,\@@_tl_gput_left:No}
-% \begin{macro}{\@@_tl_gclear:N,\@@_tl_gclear:c}
-% \begin{macro}{\@@_tl_gset_eq:NN}
+% \begin{macro}{\@@_tl_set:Nn,\@@_tl_set:Nx,
+%               \@@_tl_set:cn,\@@_tl_set:cx}
 %   Private copies of a few \pkg{expl3} functions.  \pkg{l3debug} will
 %   only add debugging to the public names, not to these copies, so we
 %   don't have to use \cs{debug_suspend:} and \cs{debug_resume:}
 %   everywhere.
+%
+%   Functions like \cs{@@_tl_set:Nn} have to be redefined, rather than
+%   copied because in \pkg{expl3} they use
+%   \cs[no-index]{__kernel_tl_(g)set:Nx}, which is also patched by
+%   \pkg{l3debug}.
+%   \changes{v1.0h}{2021/01/07}{Manually define some \pkg{l3tl} commands
+%     to work around \pkg{expl3} changes}
 %    \begin{macrocode}
-\cs_new_eq:NN \@@_tl_set:Nn \tl_set:Nn
-\cs_generate_variant:Nn \@@_tl_set:Nn { cn, cx }
-\cs_new_eq:NN \@@_tl_gset:Nn \tl_gset:Nn
-\cs_generate_variant:Nn \@@_tl_gset:Nn { cn, co, cx }
-\cs_new_eq:NN \@@_tl_gput_right:Nn \tl_gput_right:Nn
-\cs_generate_variant:Nn \@@_tl_gput_right:Nn { No, cn }
-\cs_new_eq:NN \@@_tl_gput_left:Nn \tl_gput_left:Nn
-\cs_generate_variant:Nn \@@_tl_gput_left:Nn { No }
-\cs_new_protected:Npn \@@_tl_gclear:N #1
-  { \@@_tl_gset_eq:NN #1 \c_empty_tl }
-\cs_generate_variant:Nn \@@_tl_gclear:N { c }
-\cs_new_eq:NN \@@_tl_gset_eq:NN \tl_gset_eq:NN
+\cs_new_protected:Npn \@@_tl_set:Nn #1#2
+  { \cs_set_nopar:Npx #1 { \__kernel_exp_not:w {#2} } }
+\cs_new_protected:Npn \@@_tl_set:Nx #1#2
+  { \cs_set_nopar:Npx #1 {#2} }
+\cs_generate_variant:Nn \@@_tl_set:Nn { c }
+\cs_generate_variant:Nn \@@_tl_set:Nx { c }
 %    \end{macrocode}
 % \end{macro}
+%
+% \begin{macro}{\@@_tl_gset:Nn,\@@_tl_gset:No,\@@_tl_gset:Nx,
+%               \@@_tl_gset:cn,\@@_tl_gset:co,\@@_tl_gset:cx}
+%   Same as above.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_tl_gset:Nn #1#2
+  { \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w {#2} } }
+\cs_new_protected:Npn \@@_tl_gset:No #1#2
+  { \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w \exp_after:wN {#2} } }
+\cs_new_protected:Npn \@@_tl_gset:Nx #1#2
+  { \cs_gset_nopar:Npx #1 {#2} }
+\cs_generate_variant:Nn \@@_tl_gset:Nn { c }
+\cs_generate_variant:Nn \@@_tl_gset:No { c }
+\cs_generate_variant:Nn \@@_tl_gset:Nx { c }
+%    \end{macrocode}
 % \end{macro}
+%
+% \begin{macro}{\@@_tl_gput_right:Nn,\@@_tl_gput_right:No,\@@_tl_gput_right:cn}
+%   Same as above.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_tl_gput_right:Nn #1#2
+  { \@@_tl_gset:Nx #1 { \__kernel_exp_not:w \exp_after:wN { #1 #2 } } }
+\cs_generate_variant:Nn \@@_tl_gput_right:Nn { No, cn }
+%    \end{macrocode}
 % \end{macro}
+%
+% \begin{macro}{\@@_tl_gput_left:Nn,\@@_tl_gput_left:No}
+%   Same as above.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_tl_gput_left:Nn #1#2
+  {
+    \@@_tl_gset:Nx #1
+      { \__kernel_exp_not:w {#2} \__kernel_exp_not:w \exp_after:wN {#1} }
+  }
+\cs_generate_variant:Nn \@@_tl_gput_left:Nn { No }
+%    \end{macrocode}
 % \end{macro}
+%
+% \begin{macro}{\@@_tl_gset_eq:NN}
+%   Same as above.
+%    \begin{macrocode}
+\cs_new_eq:NN \@@_tl_gset_eq:NN \tl_gset_eq:NN
+%    \end{macrocode}
 % \end{macro}
+%
+% \begin{macro}{\@@_tl_gclear:N,\@@_tl_gclear:c}
+%   Same as above.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_tl_gclear:N #1
+  { \@@_tl_gset_eq:NN #1 \c_empty_tl }
+\cs_generate_variant:Nn \@@_tl_gclear:N { c }
+%    \end{macrocode}
 % \end{macro}
 %
 %
@@ -2527,11 +2572,20 @@
   { \@@_strip_double_slash:n {#1} }
 \cs_new:Npn \@@_strip_double_slash:n #1
   { \@@_strip_double_slash:w #1 // \s_@@_mark }
-\cs_new:Npn \@@_strip_double_slash:w #1 // #2 \s_@@_mark
+%    \end{macrocode}
+%   This function is always called after testing if the argument is a
+%   file hook with \cs{@@_if_file_hook:wTF}, so we can assume it has
+%   three parts (it is either \verb|file/before/...| or
+%   \verb|file/after/...|), so we use \verb|#1/#2/#3 //| instead of just
+%   \verb|#1 //| to prevent losing a slash if the file name is empty.
+%   \changes{v1.0h}{2021/01/07}{Assume hook name has at least three
+%     nonempty parts (gh/464)}
+%    \begin{macrocode}
+\cs_new:Npn \@@_strip_double_slash:w #1/#2/#3 // #4 \s_@@_mark
   {
-    \tl_if_empty:nTF {#2}
-      {#1}
-      { \@@_strip_double_slash:w #1 / #2 \s_@@_mark }
+    \tl_if_empty:nTF {#4}
+      { #1/#2/#3 }
+      { \@@_strip_double_slash:w #1/#2/#3 / #4 \s_@@_mark }
   }
 %    \end{macrocode}
 % \end{macro}
-- 
cgit v1.2.3

