From c8a8389b451ae31ce16dad7f82b0866b662c0fcc Mon Sep 17 00:00:00 2001 From: Karl Berry 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/ltfilehook.dtx | 93 +++++++++++-------- Master/texmf-dist/source/latex/base/lthooks.dtx | 102 ++++++++++++++++----- Master/texmf-dist/source/latex/base/ltvers.dtx | 2 +- 3 files changed, 133 insertions(+), 64 deletions(-) (limited to 'Master/texmf-dist/source/latex') diff --git a/Master/texmf-dist/source/latex/base/ltfilehook.dtx b/Master/texmf-dist/source/latex/base/ltfilehook.dtx index c7ed13f041a..b4f716748a8 100644 --- a/Master/texmf-dist/source/latex/base/ltfilehook.dtx +++ b/Master/texmf-dist/source/latex/base/ltfilehook.dtx @@ -31,8 +31,8 @@ %%% From File: ltfilehook.dtx % % \begin{macrocode} -\providecommand\ltfilehookversion{v1.0d} -\providecommand\ltfilehookdate{2020/11/24} +\providecommand\ltfilehookversion{v1.0e} +\providecommand\ltfilehookdate{2021/01/07} % \end{macrocode} % %<*driver> @@ -514,7 +514,6 @@ % \begin{macro}{ % \@@_file_parse_full_name:nN, % \@@_full_name:nn, -% \@@_set_curr_file_assign:nnnNN % } % A utility macro to trigger \pkg{expl3}'s file-parsing and lookup, % and return a normalized representation of the file name. If the @@ -711,14 +710,33 @@ % {\InputIfFileExists}{Hook management (files)}% %<*2ekernel|latexrelease> % \end{macrocode} -% +% % \begin{macrocode} \let\InputIfFileExists\@undefined \DeclareRobustCommand \InputIfFileExists[2]{% \IfFileExists{#1}% {% - \@expl@@@filehook@file@push@@ - \@filehook@set@CurrentFile + \@expl@@@filehook@file@push@@ + \@filehook@set@CurrentFile +% \end{macrocode} +% We pre-expand \cs{@filef@und} so that in case another file is +% loaded in the true branch of \cs{InputIfFileExists}, these don't +% change their value meanwhile. This isn't a worry with +% \cs[no-index]{CurrentFile...} because they are kept in a stack. +% +% \changes{v1.0d}{2020/11/20} +% {Move loading to \cs{@input@file@exists@with@hooks} and expand +% \cs{@filef@und} to avoid getting the wrong file name in the case of +% a substitution.} +% \begin{macrocode} + \expandafter\@swaptwoargs\expandafter + {\expandafter\@input@file@exists@with@hooks + \expandafter{\@filef@und}}% + {#2}% + \@expl@@@filehook@file@pop@@ + }% +} +\def\@input@file@exists@with@hooks#1{% % \end{macrocode} % If the file exists then \cs{CurrentFile} holds its name. But we % can't rely on that still being true after the file has been @@ -740,32 +758,16 @@ % the file name and extension are returned so that file hooks can % refer to the file by their name only. The path to the file is % returned in \cs{CurrentFilePath}. +% \changes{v1.0e}{2021/01/07}{Restore \cs[no-index]{CurrentFile(Path)(Used)} +% after the input (gh/464)} % \begin{macrocode} - \edef\reserved@a{% - \@expl@@@filehook@file@pop@assign@@nnnn - {\CurrentFilePathUsed}% - {\CurrentFileUsed}% - {\CurrentFilePath}% - {\CurrentFile}% -% \end{macrocode} -% -% We pre-expand \cs{@filef@und} so that in case another file is -% loaded in the true branch of \cs{InputIfFileExists}, these don't -% change their value meanwhile. This isn't a worry with -% \cs[no-index]{CurrentFile...} because they are kept in a stack. -% -% \changes{v1.0d}{2020/11/20} -% {Move loading to \cs{@input@file@exists@with@hooks} and expand -% \cs{@filef@und} to avoid getting the wrong file name in the case of -% a substitution.} -% \begin{macrocode} - \noexpand\@input@file@exists@with@hooks{\@filef@und}}% - \expandafter\@swaptwoargs\expandafter - {\reserved@a}% - {#2}% - \@expl@@@filehook@file@pop@@ - }% -} + \edef\reserved@a{% + \@expl@@@filehook@file@pop@assign@@nnnn + {\CurrentFilePathUsed}% + {\CurrentFileUsed}% + {\CurrentFilePath}% + {\CurrentFile}}% + \expandafter\@swaptwoargs\expandafter{\reserved@a}% % \end{macrocode} % % Before adding to the file list we need to make all (letter) characters @@ -787,18 +789,19 @@ % approach (grepping the packages in \TeX{} Live didn't bring up any % obvious candidate for breaking with this catcode change). % \begin{macrocode} -\def\@input@file@exists@with@hooks#1{% - \edef\reserved@a{\unqu@tefilef@und#1\@nil}% - \@addtofilelist{\string@makeletter\reserved@a}% - \UseHook{file/before}% + {\edef\reserved@a{\unqu@tefilef@und#1\@nil}% + \@addtofilelist{\string@makeletter\reserved@a}% + \UseHook{file/before}% % \end{macrocode} % The current file name is available in \cs{CurrentFile} so we use % that in the specific hook. % \begin{macrocode} - \UseHook{file/before/\CurrentFile}% - \@@input #1% <- trailing space comes from \@filef@und + \UseHook{file/before/\CurrentFile}% + \@@input #1% <- trailing space comes from \@filef@und + }% % \end{macrocode} -% And it is restored here so we can use it once more. +% And here, \cs{CurrentFile} is restored +% (by \cs{@expl@@@filehook@file@pop@assign@@nnnn}) so we can use it once more. % \begin{macrocode} \UseHook{file/after/\CurrentFile}% \UseHook{file/after}} @@ -1488,10 +1491,22 @@ % \begin{macrocode} \ExplSyntaxOff % \end{macrocode} -% +% +% This one specifically has to be undefined because it is left over in +% the input stream from \cs{InputIfFileExists} and executed when +% \pkg{latexrelease} is loaded. It cannot be \cs{let} to \cs{@undefined} +% otherwise it would error as well, so it is \cs{let} to \cs{relax} to +% be silently ignored when loading \cs{latexrelease}. +% \changes{v1.0e}{2021/01/07}{Added rollback for this case to avoid +% spurious errors (part of gh/463)} % \begin{macrocode} % %\EndIncludeInRelease +% +%\IncludeInRelease{0000/00/00}% +% {\@expl@@@filehook@if@no@extension@@nTF}{2e tmp interfaces}% +%\let\@expl@@@filehook@file@pop@@\relax +%\EndIncludeInRelease %<*2ekernel> % \end{macrocode} % 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} diff --git a/Master/texmf-dist/source/latex/base/ltvers.dtx b/Master/texmf-dist/source/latex/base/ltvers.dtx index c2ec2ffde33..c42a126a31c 100644 --- a/Master/texmf-dist/source/latex/base/ltvers.dtx +++ b/Master/texmf-dist/source/latex/base/ltvers.dtx @@ -115,7 +115,7 @@ {2020-10-01} % %<*2ekernel> -\def\patch@level{3} +\def\patch@level{4} % \end{macrocode} % % \begin{macro}{\development@branch@name} -- cgit v1.2.3