From b0c666dbd315af330424f5d34739d7d4134d0c17 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 2 Jun 2024 20:26:39 +0000 Subject: latex2e (2jun24) git-svn-id: svn://tug.org/texlive/trunk@71408 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/base/lthooks.dtx | 405 +++++++++++++++--------- 1 file changed, 260 insertions(+), 145 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 446cdaae060..d282ff841c7 100644 --- a/Master/texmf-dist/source/latex/base/lthooks.dtx +++ b/Master/texmf-dist/source/latex/base/lthooks.dtx @@ -27,17 +27,16 @@ % \fi % % \iffalse -% %%% From File: lthooks.dtx % -% \begin{macrocode} -\def\lthooksversion{v1.1f} -\def\lthooksdate{2023/10/02} -% \end{macrocode} -% %<*driver> +% \fi +\ProvidesFile{lthooks.dtx} + [2024/04/22 v1.1h LaTeX Kernel (hooks)] +% \iffalse +% \documentclass{l3doc} - +\GetFileInfo{lthooks.dtx} \providecommand\InternalDetectionOff{} \providecommand\InternalDetectionOn{} @@ -62,7 +61,7 @@ % % % \title{\LaTeX{}'s hook management\thanks{This module has version -% \lthooksversion\ dated \lthooksdate, \copyright\ \LaTeX\ +% \fileversion\ dated \filedate, \copyright\ \LaTeX\ % Project.}} % % \author{Frank Mittelbach\thanks{Code improvements for speed and other goodies by Phelype Oleinik}} @@ -160,7 +159,7 @@ % \end{function} % % -% \begin{function}{\NewHookWithArguments} +% \begin{function}[added=2023-06-01]{\NewHookWithArguments} % \begin{syntax} % \cs{NewHookWithArguments} \Arg{hook} \Arg{number} % \end{syntax} @@ -172,7 +171,7 @@ % the current package name. See section~\ref{sec:default-label}. % \end{function} % -% \begin{function}{\NewReversedHookWithArguments} +% \begin{function}[added=2023-06-01]{\NewReversedHookWithArguments} % \begin{syntax} % \cs{NewReversedHookWithArguments} \Arg{hook} \Arg{number} % \end{syntax} @@ -184,7 +183,7 @@ % the current package name. See section~\ref{sec:default-label}. % \end{function} % -% \begin{function}{\NewMirroredHookPairWithArguments} +% \begin{function}[added=2023-06-01]{\NewMirroredHookPairWithArguments} % \begin{syntax} % \cs{NewMirroredHookPairWithArguments} \Arg{hook-1} \Arg{hook-2} \Arg{number} % \end{syntax} @@ -234,9 +233,9 @@ % (e.g., one used in code with \cs{UseHook} or % \cs{UseOneTimeHook}) without it being explicitly declared with % \cs{NewHook}). -% This command undoes the effect of \cs{DisableGenericHook}. % If the hook is already activated, this command does nothing. % +% Note that this command does not undo the effect of \cs{DisableGenericHook}. % See section~\ref{sec:generic-hooks} for a discussion of when this % declaration is appropriate. % \end{function} @@ -264,7 +263,7 @@ % A leading |.| is treated literally. % \end{function} % -% \begin{function}{\UseHookWithArguments} +% \begin{function}[added=2023-06-01]{\UseHookWithArguments} % \begin{syntax} % \cs{UseHookWithArguments} \Arg{hook} \Arg{number} \Arg{arg_1} \ldots \Arg{arg_n} % \end{syntax} @@ -314,7 +313,7 @@ % % \end{function} % -% \begin{function}{\UseOneTimeHookWithArguments} +% \begin{function}[added=2023-06-01]{\UseOneTimeHookWithArguments} % \begin{syntax} % \cs{UseOneTimeHookWithArguments} \Arg{hook} \Arg{number} \Arg{arg_1} \ldots \Arg{arg_n} % \end{syntax} @@ -340,7 +339,7 @@ % % \begin{function}{\AddToHook} % \begin{syntax} -% \cs{AddToHook} \Arg{hook}\oarg{label}\Arg{code} +% \cs{AddToHook} \Arg{hook} \oarg{label} \Arg{code} % \end{syntax} % Adds \meta{code} to the \meta{hook} labeled by \meta{label}. % When the optional argument \meta{label} is not provided, the @@ -368,9 +367,9 @@ % See section~\ref{sec:default-label}. % \end{function} % -% \begin{function}{\AddToHookWithArguments} +% \begin{function}[added=2023-06-01]{\AddToHookWithArguments} % \begin{syntax} -% \cs{AddToHookWithArguments} \Arg{hook}\oarg{label}\Arg{code} +% \cs{AddToHookWithArguments} \Arg{hook} \oarg{label} \Arg{code} % \end{syntax} % Works exactly like \cs{AddToHook}, except that the \meta{code} can % access the arguments passed to the hook using \verb|#1|, \verb|#2|, @@ -398,7 +397,7 @@ % % \begin{function}{\RemoveFromHook} % \begin{syntax} -% \cs{RemoveFromHook} \Arg{hook}\oarg{label} +% \cs{RemoveFromHook} \Arg{hook} \oarg{label} % \end{syntax} % Removes any code labeled by \meta{label} from the \meta{hook}. % When the optional argument \meta{label} is not provided, the @@ -459,7 +458,7 @@ % % \begin{function}{\AddToHookNext} % \begin{syntax} -% \cs{AddToHookNext} \Arg{hook}\Arg{code} +% \cs{AddToHookNext} \Arg{hook} \Arg{code} % \end{syntax} % Adds \meta{code} to the next invocation of the \meta{hook}. % The code is executed after the normal hook code has finished and @@ -505,9 +504,9 @@ % \end{function}\footnotetext{There is % no mechanism to reorder such code chunks (or delete them).} % -% \begin{function}{\AddToHookNextWithArguments} +% \begin{function}[added=2023-06-01]{\AddToHookNextWithArguments} % \begin{syntax} -% \cs{AddToHookNextWithArguments} \Arg{hook}\Arg{code} +% \cs{AddToHookNextWithArguments} \Arg{hook} \Arg{code} % \end{syntax} % Works exactly like \cs{AddToHookNext}, but the \meta{code} can % contain references to the arguments of the \meta{hook} as described @@ -522,7 +521,7 @@ % % \begin{function}{\ClearHookNext} % \begin{syntax} -% \cs{ClearHookNext}\Arg{hook} +% \cs{ClearHookNext} \Arg{hook} % \end{syntax} % Normally \cs{AddToHookNext} is only used when you know precisely % where it will apply and why you want some extra code at that @@ -746,7 +745,7 @@ % % \begin{function}{\DeclareHookRule} % \begin{syntax} -% \cs{DeclareHookRule} \Arg{hook}\Arg{label1}\Arg{relation}\Arg{label2} +% \cs{DeclareHookRule} \Arg{hook} \Arg{label1} \Arg{relation} \Arg{label2} % \end{syntax} % Defines a relation between \meta{label1} and \meta{label2} for a % given \meta{hook}. If \meta{hook} is \texttt{??} this defines a default @@ -807,7 +806,7 @@ % % \begin{function}{\ClearHookRule} % \begin{syntax} -% \cs{ClearHookRule}\Arg{hook}\Arg{label1}\Arg{label2} +% \cs{ClearHookRule} \Arg{hook} \Arg{label1} \Arg{label2} % \end{syntax} % Syntactic sugar for saying that \meta{label1} and \meta{label2} % are unrelated for the given \meta{hook}. @@ -817,7 +816,7 @@ % % \begin{function}{\DeclareDefaultHookRule} % \begin{syntax} -% \cs{DeclareDefaultHookRule}\Arg{label1}\Arg{relation}\Arg{label2} +% \cs{DeclareDefaultHookRule} \Arg{label1} \Arg{relation} \Arg{label2} % \end{syntax} % This sets up a relation between \meta{label1} and \meta{label2} % for all hooks unless overwritten by a specific rule for a hook. @@ -1004,7 +1003,7 @@ % % \begin{function}{\DebugHooksOn,\DebugHooksOff} % \begin{syntax} -% \cs{DebugHooksOn} +% \cs{DebugHooksOn} \ldots\ \cs{DebugHooksOff} % \end{syntax} % Turn the debugging of hook code on or off. This displays most changes % made to the hook data structures. The output is rather coarse and @@ -1044,7 +1043,7 @@ % the current package name. See section~\ref{sec:default-label}. % \end{function} % -% \begin{function}{ +% \begin{function}[added=2023-06-01]{ % \hook_new_with_args:nn, % \hook_new_reversed_with_args:nn, % \hook_new_pair_with_args:nnn @@ -1100,9 +1099,14 @@ % % % -% \begin{function}{\hook_use:n,\hook_use:nnw} +% \begin{function}{\hook_use:n} +% \begin{syntax} +% ~~\cs{hook_use:n} \Arg{hook} +% \end{syntax} +% \end{function} +% \vskip-1.2\baselineskip +% \begin{function}[added=2023-06-01]{\hook_use:nnw} % \begin{syntax} -% \cs{hook_use:n} \Arg{hook} % \cs{hook_use:nnw} \Arg{hook} \Arg{number} \Arg{arg_1} \ldots \Arg{arg_n} % \end{syntax} % Executes the \Arg{hook} code followed (if set up) by the code for next @@ -1118,9 +1122,14 @@ % A leading |.| is treated literally. % \end{function} % -% \begin{function}{\hook_use_once:n,\hook_use_once:nnw} +% \begin{function}{\hook_use_once:n} % \begin{syntax} % \cs{hook_use_once:n} \Arg{hook} +% \end{syntax} +% \end{function} +% \vskip-1.2\baselineskip +% \begin{function}[added=2023-06-01]{\hook_use_once:nnw} +% \begin{syntax} % \cs{hook_use_once:nnw} \Arg{hook} \Arg{number} \Arg{arg_1} \ldots \Arg{arg_n} % \end{syntax} % Changes the \Arg{hook} status so that from now on any addition to @@ -1139,10 +1148,16 @@ % % \begin{function}{ % \hook_gput_code:nnn, +% } +% \begin{syntax} +% ~~~~~~~~~\cs{hook_gput_code:nnn} \Arg{hook} \Arg{label} \Arg{code} +% \end{syntax} +% \end{function} +% \vskip -1.2\baselineskip +% \begin{function}[added=2023-06-01]{ % \hook_gput_code_with_args:nnn % } % \begin{syntax} -% \cs{hook_gput_code:nnn} \Arg{hook} \Arg{label} \Arg{code} % \cs{hook_gput_code_with_args:nnn} \Arg{hook} \Arg{label} \Arg{code} % \end{syntax} % Adds a chunk of \meta{code} to the \meta{hook} labeled @@ -1168,10 +1183,17 @@ % % \begin{function}{ % \hook_gput_next_code:nn, +% } +% \begin{syntax} +% ~~~~~~~~~~~~~\cs{hook_gput_next_code:nn} \Arg{hook} \Arg{code} +% \end{syntax} +% \end{function} +% \vskip-1.2\baselineskip +% \begin{function}[added=2023-06-01]{ % \hook_gput_next_code_with_args:nn, % } % \begin{syntax} -% \cs{hook_gput_next_code:nn} \Arg{hook} \Arg{code} +% \cs{hook_gput_next_code_with_args:nn} \Arg{hook} \Arg{code} % \end{syntax} % Adds a chunk of \meta{code} for use only in the next invocation of the % \meta{hook}. Once used it is gone. @@ -1183,6 +1205,7 @@ % In that case, if an actual parameter token should be added to the % code, it should be doubled. % +% \end{function} % This is simpler than \cs{hook_gput_code:nnn}, the code is simply % appended to the hook in the order of declaration at the very end, % i.e., after all standard code for the hook got executed. @@ -1191,7 +1214,6 @@ % % The \meta{hook} can be specified using the dot-syntax to denote % the current package name. See section~\ref{sec:default-label}. -% \end{function} % % % \begin{function}{\hook_gclear_next_code:n} @@ -1527,7 +1549,7 @@ % \hook{cmd}, % \hook{env}, % \hook{file}, -% \hook{include} +% \hook{include}, % \hook{package}, and % \hook{class}, % and all these are available out of the box: you only have to @@ -1862,15 +1884,17 @@ % \item[\hook{env/\meta{env}/begin}] % % This hook is executed as part of \cs{begin} directly in front -% of the code specific to the environment start (e.g., the -% second argument of \cs{newenvironment}). Its scope is the -% environment body. +% of the code specific to the environment start (e.g., +% the third argument of \cs{NewDocumentEnvironment} and +% the second argument of \cs{newenvironment}). +% Its scope is the environment body. % % \item[\hook{env/\meta{env}/end}] % % This hook is executed as part of \cs{end} directly in front of the -% code specific to the end of the environment (e.g., the third -% argument of \cs{newenvironment}). +% code specific to the end of the environment (e.g., +% the forth argument of \cs{NewDocumentEnvironment} and +% the third argument of \cs{newenvironment}). % % \item[\hook{env/\meta{env}/after}] % @@ -2701,7 +2725,7 @@ % \hook_new:n, % \hook_new_with_args:nn % } -% \begin{macro}{@@_new:nn} +% \begin{macro}{\@@_new:nn} % The \cs{hook_new:n} declaration declares a new hook and expects % the hook \meta{name} as its argument, e.g., % \hook{begindocument}. @@ -3509,7 +3533,8 @@ \msg_error:nnnnn { hooks } { set-top-level } { for } { SetDefaultHookLabel } {#1} } - { \exp_args:Nx \@@_set_default_label:n { \@@_make_name:n {#1} } } + { \exp_args:Nx + \@@_set_default_label:n { \@@_make_name:n {#1} } } } \cs_new_protected:Npn \@@_set_default_label:n #1 { @@ -3722,7 +3747,8 @@ %\IncludeInRelease{2020/10/01}{\hook_gput_code:nnn} % {Providing~hooks} %\cs_gset_protected:Npn \hook_gput_code:nnn #1 #2 -% { \@@_normalize_hook_args:Nnn \@@_gput_code:nnn {#1} {#2} } +% { \@@_normalize_hook_args:Nnn +% \@@_gput_code:nnn {#1} {#2} } %\cs_gset_protected:Npn \@@_gput_code:nnn #1 #2 #3 % { % \@@_if_execute_immediately:nTF {#1} @@ -3736,7 +3762,8 @@ % { % \@@_if_disabled:nTF {#1} % { \msg_error:nnn { hooks } { hook-disabled } {#1} } -% { \@@_try_declaring_generic_hook:nnn {#1} {#2} {#3} } +% { \@@_try_declaring_generic_hook:nnn +% {#1} {#2} {#3} } % } % } % } @@ -3748,7 +3775,8 @@ % \on@line\space <-~ \tl_to_str:n{#3}} } % \str_if_eq:nnTF {#2} { top-level } % { -% \str_if_eq:eeTF { top-level } { \@@_currname_or_default: } +% \str_if_eq:eeTF { top-level } +% { \@@_currname_or_default: } % { % \@@_init_structure:n {#1} % \@@_tl_gput_right:cn { @@_toplevel~#1 } {#3} @@ -3756,7 +3784,8 @@ % { \msg_error:nnn { hooks } { misused-top-level } {#1} } % } % { -% \prop_get:cnNTF { g_@@_#1_code_prop } {#2} \l_@@_return_tl +% \prop_get:cnNTF +% { g_@@_#1_code_prop } {#2} \l_@@_return_tl % { % \prop_gput:cno { g_@@_#1_code_prop } {#2} % { \l_@@_return_tl #3 } @@ -3840,7 +3869,8 @@ % \changes{v1.1d}{2023/05/21} % {Changes to allow support arguments in cmd hooks (cmd-args).} % \begin{macrocode} -%\IncludeInRelease{2023/06/01}{\@@_try_declaring_generic_hook:nnn} +%\IncludeInRelease{2023/06/01} +% {\@@_try_declaring_generic_hook:nnn} % {Hooks~with~args} \cs_new_protected:Npn \@@_try_declaring_generic_hook:nnn #1 { @@ -3857,31 +3887,38 @@ {#1} } %\EndIncludeInRelease -%\IncludeInRelease{2021/11/15}{\@@_try_declaring_generic_hook:nnn} +%\IncludeInRelease{2021/11/15} +% {\@@_try_declaring_generic_hook:nnn} % {Standardise~generic~hook~names} %\cs_gset_protected:Npn \@@_try_declaring_generic_hook:nnn #1 % { -% \@@_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1} +% \@@_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: +% {#1} % \hook_gput_code:nnn % \@@_gput_undeclared_hook:nnn % {#1} % } -%\cs_gset_protected:Npn \@@_try_declaring_generic_next_hook:nn #1 +%\cs_gset_protected:Npn +% \@@_try_declaring_generic_next_hook:nn #1 % { -% \@@_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1} +% \@@_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: +% {#1} % \hook_gput_next_code:nn % \@@_gput_next_do:nn % {#1} % } %\EndIncludeInRelease -%\IncludeInRelease{2020/10/01}{\@@_try_declaring_generic_hook:nnn} +%\IncludeInRelease{2020/10/01} +% {\@@_try_declaring_generic_hook:nnn} % {Standardise~generic~hook~names} -%\cs_new_protected:Npn \@@_try_declaring_generic_hook:nnn #1 +%\cs_new_protected:Npn +% \@@_try_declaring_generic_hook:nnn #1 % { % \@@_try_declaring_generic_hook:nNNnn {#1} % \hook_gput_code:nnn \@@_gput_undeclared_hook:nnn % } -%\cs_new_protected:Npn \@@_try_declaring_generic_next_hook:nn #1 +%\cs_new_protected:Npn +% \@@_try_declaring_generic_next_hook:nn #1 % { % \@@_try_declaring_generic_hook:nNNnn {#1} % \hook_gput_next_code:nn \@@_gput_next_do:nn @@ -3904,12 +3941,15 @@ % % \changes{v1.0s}{2021/09/28} % {Correct usage of older \cs{@@_if_file_hook:wTF} (gh/675)} +% \changes{v1.1h}{2024/01/24} +% {Correct usage of older \cs{@@_if_file_hook:wTF} (gh/1243)} % \begin{macrocode} %\cs_new_protected:Npn \@@_try_declaring_generic_hook:nNNnn #1 % { -% \@@_if_file_hook:wTF #1 / \s_@@_mark +% \@@_if_file_hook:wTF #1 / / \s_@@_mark % { -% \exp_args:Ne \@@_try_declaring_generic_hook_split:nNNnn +% \exp_args:Ne +% \@@_try_declaring_generic_hook_split:nNNnn % { \exp_args:Ne \@@_file_hook_normalize:n {#1} } % } % { \@@_try_declaring_generic_hook_split:nNNnn {#1} } @@ -3917,9 +3957,11 @@ % \end{macrocode} % % \begin{macrocode} -%\cs_new_protected:Npn \@@_try_declaring_generic_hook_split:nNNnn #1 #2 #3 +%\cs_new_protected:Npn +% \@@_try_declaring_generic_hook_split:nNNnn #1 #2 #3 % { -% \@@_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: {#1} +% \@@_try_declaring_generic_hook:wnTF #1 / / / \scan_stop: +% {#1} % { #2 } % { #3 } {#1} % } @@ -3931,9 +3973,11 @@ % \changes{v1.1a}{2023/04/06} % {Changes to add hook arguments (hook-args).} % \begin{macrocode} -%\IncludeInRelease{2023/06/01}{\@@_try_declaring_generic_hook:wn} +%\IncludeInRelease{2023/06/01} +% {\@@_try_declaring_generic_hook:wn} % {Hooks~with~args} -\prg_new_protected_conditional:Npnn \@@_try_declaring_generic_hook:wn +\prg_new_protected_conditional:Npnn + \@@_try_declaring_generic_hook:wn #1 / #2 / #3 / #4 \scan_stop: #5 { TF } { \@@_if_generic:nTF {#5} @@ -4052,9 +4096,11 @@ % \end{macro} % % \begin{macrocode} -%\IncludeInRelease{2021/11/15}{\@@_try_declaring_generic_hook:wn} +%\IncludeInRelease{2021/11/15} +% {\@@_try_declaring_generic_hook:wn} % {Standardise~generic~hook~names} -%\prg_new_protected_conditional:Npnn \@@_try_declaring_generic_hook:wn +%\prg_new_protected_conditional:Npnn +% \@@_try_declaring_generic_hook:wn % #1 / #2 / #3 / #4 \scan_stop: #5 { TF } % { % \@@_if_generic:nTF {#5} @@ -4083,9 +4129,11 @@ % \end{macrocode} % % \begin{macrocode} -%\IncludeInRelease{2021/06/01}{\@@_try_declaring_generic_hook:wn} +%\IncludeInRelease{2021/06/01} +% {\@@_try_declaring_generic_hook:wn} % {Support~cmd~hooks} -%\prg_new_protected_conditional:Npnn \@@_try_declaring_generic_hook:wn +%\prg_new_protected_conditional:Npnn +% \@@_try_declaring_generic_hook:wn % #1 / #2 / #3 / #4 \scan_stop: #5 { TF } % { % \tl_if_empty:nTF {#2} @@ -4099,10 +4147,12 @@ % { \@@_try_put_cmd_hook:n {#5} } % \@@_make_usable:n {#5} % } -% \prop_if_in:NnTF \c_@@_generics_reversed_ii_prop {#2} +% \prop_if_in:NnTF +% \c_@@_generics_reversed_ii_prop {#2} % { \tl_gset:cn { g_@@_#5_reversed_tl } { - } } % { -% \prop_if_in:NnT \c_@@_generics_reversed_iii_prop {#3} +% \prop_if_in:NnT +% \c_@@_generics_reversed_iii_prop {#3} % { \tl_gset:cn { g_@@_#5_reversed_tl } { - } } % } % \prg_return_true: @@ -4114,9 +4164,11 @@ % \end{macrocode} % % \begin{macrocode} -%\IncludeInRelease{2020/10/01}{\@@_try_declaring_generic_hook:wn} +%\IncludeInRelease{2020/10/01} +% {\@@_try_declaring_generic_hook:wn} % {Support~cmd~hooks} -%\prg_new_protected_conditional:Npnn \@@_try_declaring_generic_hook:wn +%\prg_new_protected_conditional:Npnn +% \@@_try_declaring_generic_hook:wn % #1 / #2 / #3 / #4 \scan_stop: #5 { TF } % { % \tl_if_empty:nTF {#2} @@ -4125,10 +4177,12 @@ % \prop_if_in:NnTF \c_@@_generics_prop {#1} % { % \@@_if_declared:nF {#5} { \hook_new:n {#5} } -% \prop_if_in:NnTF \c_@@_generics_reversed_ii_prop {#2} +% \prop_if_in:NnTF +% \c_@@_generics_reversed_ii_prop {#2} % { \tl_gset:cn { g_@@_#5_reversed_tl } { - } } % { -% \prop_if_in:NnT \c_@@_generics_reversed_iii_prop {#3} +% \prop_if_in:NnT +% \c_@@_generics_reversed_iii_prop {#3} % { \tl_gset:cn { g_@@_#5_reversed_tl } { - } } % } % \prg_return_true: @@ -4204,11 +4258,11 @@ % \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 +%\cs_new:Npn \@@_strip_double_slash:w #1/#2/#3//#4\s_@@_mark % { % \tl_if_empty:nTF {#4} % { #1/#2/#3 } -% { \@@_strip_double_slash:w #1/#2/#3 / #4 \s_@@_mark } +% { \@@_strip_double_slash:w #1/#2/#3 /#4\s_@@_mark } % } %\EndIncludeInRelease % \end{macrocode} @@ -4287,9 +4341,12 @@ % \begin{macrocode} %\IncludeInRelease{2020/10/01}{\c_@@_generics_reversed_ii_prop} % {Standardise~generic~hook~names} -%\prop_const_from_keyval:Nn \c_@@_generics_reversed_ii_prop {after=,end=} -%\prop_const_from_keyval:Nn \c_@@_generics_reversed_iii_prop {after=} -%\prop_const_from_keyval:Nn \c_@@_generics_file_prop {before=,after=} +%\prop_const_from_keyval:Nn +% \c_@@_generics_reversed_ii_prop {after=,end=} +%\prop_const_from_keyval:Nn +% \c_@@_generics_reversed_iii_prop {after=} +%\prop_const_from_keyval:Nn +% \c_@@_generics_file_prop {before=,after=} %\EndIncludeInRelease % \end{macrocode} % \end{macro} @@ -4369,7 +4426,8 @@ \str_if_eq:nnTF {#2} { top-level } { \@@_toplevel_gset:nn {#1} { } } { - \prop_gpop:cnNF { g_@@_#1_code_prop } {#2} \l_@@_return_tl + \prop_gpop:cnNF { g_@@_#1_code_prop } + {#2} \l_@@_return_tl { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} } } } @@ -4387,7 +4445,8 @@ \@@_if_deprecated_generic:nTF {#1} { \@@_deprecated_generic_warn:n {#1} - \@@_do_deprecated_generic:Nn \@@_gremove_code:nn {#1} {#2} + \@@_do_deprecated_generic:Nn + \@@_gremove_code:nn {#1} {#2} } { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} } } @@ -4412,8 +4471,10 @@ % \str_if_eq:nnTF {#2} { top-level } % { \@@_tl_gclear:c { @@_toplevel~#1 } } % { -% \prop_gpop:cnNF { g_@@_#1_code_prop } {#2} \l_@@_return_tl -% { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} } +% \prop_gpop:cnNF { g_@@_#1_code_prop } +% {#2} \l_@@_return_tl +% { \msg_warning:nnnn { hooks } { cannot-remove } +% {#1} {#2} } % } % } % \@@_if_usable:nT {#1} @@ -4423,9 +4484,11 @@ % \@@_if_deprecated_generic:nTF {#1} % { % \@@_deprecated_generic_warn:n {#1} -% \@@_do_deprecated_generic:Nn \@@_gremove_code:nn {#1} {#2} +% \@@_do_deprecated_generic:Nn +% \@@_gremove_code:nn {#1} {#2} % } -% { \msg_warning:nnnn { hooks } { cannot-remove } {#1} {#2} } +% { \msg_warning:nnnn { hooks } { cannot-remove } +% {#1} {#2} } % } % } %\EndIncludeInRelease @@ -4467,7 +4530,8 @@ {#1} {#2} } \cs_new_protected:Npn \@@_cs_gput_right_fast:nnn #1 #2 #3 - { \cs_gset:cpx { @@#1~#2 } { \exp_not:v { @@#1~#2 } \exp_not:n {#3} } } + { \cs_gset:cpx { @@#1~#2 } + { \exp_not:v { @@#1~#2 } \exp_not:n {#3} } } \cs_new_protected:Npn \@@_cs_gput_right_slow:nnn #1 #2 #3 { % \end{macrocode} @@ -4693,7 +4757,8 @@ % \begin{macrocode} \exp_last_unbraced:NNf \cs_set:Npn \@@_tmp:w { \@@_parameter:n {#1} } { } - \tl_set:Ne \l_@@_tmpa_tl { \@@_braced_cs_parameter:n { @@_tmp:w } } + \tl_set:Ne \l_@@_tmpa_tl + { \@@_braced_cs_parameter:n { @@_tmp:w } } % \end{macrocode} % Now this function does the fun part. It is meant to be used with % \cs{prop_map_function:NN}, taking a label name in \verb|##1| and the @@ -5069,8 +5134,8 @@ % \@@_if_deprecated_generic:nT {#1} % { % \@@_deprecated_generic_warn:n {#1} -% \@@_do_deprecated_generic:Nn \@@_gset_rule:nnnn {#1} -% {#2} {#3} {#4} +% \@@_do_deprecated_generic:Nn \@@_gset_rule:nnnn +% {#1} {#2} {#3} {#4} % \exp_after:wN \use_none:nnnnnnnnn \use_none:n % } % \@@_init_structure:n {#1} @@ -5110,7 +5175,8 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_rule_before_gset:nnn #1#2#3 { - \@@_tl_gset:cx { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } + \@@_tl_gset:cx + { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } { \@@_label_ordered:nnTF {#2} {#3} { < } { > } } } \cs_new_eq:cN { @@_rule_<_gset:nnn } \@@_rule_before_gset:nnn @@ -5119,7 +5185,8 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_rule_after_gset:nnn #1#2#3 { - \@@_tl_gset:cx { g_@@_#1_rule_ \@@_label_pair:nn {#3} {#2} _tl } + \@@_tl_gset:cx + { g_@@_#1_rule_ \@@_label_pair:nn {#3} {#2} _tl } { \@@_label_ordered:nnTF {#3} {#2} { < } { > } } } \cs_new_eq:cN { @@_rule_>_gset:nnn } \@@_rule_after_gset:nnn @@ -5132,7 +5199,8 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_rule_voids_gset:nnn #1#2#3 { - \@@_tl_gset:cx { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } + \@@_tl_gset:cx + { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } { \@@_label_ordered:nnTF {#2} {#3} { -> } { <- } } } % \end{macrocode} @@ -5146,11 +5214,15 @@ % together in hook |#1|. % \begin{macrocode} \cs_new_protected:cpn { @@_rule_incompatible-error_gset:nnn } #1#2#3 - { \@@_tl_gset:cn { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } - { xE } } + { \@@_tl_gset:cn + { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } + { xE } + } \cs_new_protected:cpn { @@_rule_incompatible-warning_gset:nnn } #1#2#3 - { \@@_tl_gset:cn { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } - { xW } } + { \@@_tl_gset:cn + { g_@@_#1_rule_ \@@_label_pair:nn {#2} {#3} _tl } + { xW } + } % \end{macrocode} % \end{macro} % @@ -5268,7 +5340,7 @@ } % \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 +% call the hook code and not initialize it (as this was already done in the % preamble. % \begin{macrocode} \@@_post_initialization_defs: @@ -5281,7 +5353,8 @@ % {Hooks~with~args} %\cs_gset_protected:Npn \@@_initialize_all: % { -% \cs_gset_eq:NN \@@_update_hook_code:n \@@_initialize_hook_code:n +% \cs_gset_eq:NN \@@_update_hook_code:n +% \@@_initialize_hook_code:n % \@@_debug:n { \prop_gclear:N \g_@@_used_prop } % \seq_map_inline:Nn \g_@@_all_seq % { \@@_update_hook_code:n {##1} } @@ -5291,7 +5364,8 @@ % \prop_map_inline:Nn \g_@@_used_prop % { % \iow_term:x -% { ^^J ~ ##1 ~ -> ~ \cs_replacement_spec:c { @@~##1 } ~ } +% { ^^J ~ ##1 ~ -> ~ +% \cs_replacement_spec:c { @@~##1 } ~ } % } % } % \cs_gset_eq:NN \hook_use:n \@@_use_initialized:n @@ -5350,8 +5424,10 @@ % after the \verb|_next| and \verb|_toplevel| macros, so that the % arguments passed to the hook are forwarded to them. % \begin{macrocode} - \exp_not:c { @@_toplevel~#1 } \@@_braced_parameter:n {#1} - \exp_not:c { @@_next~#1 } \@@_braced_parameter:n {#1} + \exp_not:c { @@_toplevel~#1 } + \@@_braced_parameter:n {#1} + \exp_not:c { @@_next~#1 } + \@@_braced_parameter:n {#1} } } { @@ -5400,7 +5476,8 @@ %\cs_gset_protected:Npn \@@_initialize_hook_code:n #1 % { % \@@_debug:n -% { \iow_term:x { ^^J Update~code~for~hook~'#1' \on@line :^^J } } +% { \iow_term:x { ^^J Update~code~for~hook~'#1' +% \on@line :^^J } } % \@@_include_legacy_code_chunk:n {#1} % \@@_if_usable:nT {#1} % { @@ -5414,15 +5491,21 @@ % } % { % \@@_if_reversed:nTF {#1} -% { \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:Nn \@@_tl_gput_right:Nn -% \cs_set_eq:NN \@@_clist_gput:NV \clist_gput_right:NV } -% \prop_set_eq:Nc \l_@@_work_prop { g_@@_#1_code_prop } +% { \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:Nn +% \@@_tl_gput_right:Nn +% \cs_set_eq:NN \@@_clist_gput:NV +% \clist_gput_right:NV } +% \prop_set_eq:Nc \l_@@_work_prop +% { g_@@_#1_code_prop } % \@@_initialize_single:ccn % { @@~#1 } { g_@@_#1_labels_clist } {#1} % \@@_debug:n -% { \exp_args:NNx \prop_gput:Nnn \g_@@_used_prop {#1} { } } +% { \exp_args:NNx \prop_gput:Nnn \g_@@_used_prop +% {#1} { } } % } % } % } @@ -5621,7 +5704,8 @@ \int_compare:nNnT { \cs:w \@@_tl_csname:n {##1} \cs_end: } = 0 { - \tl_set:cn { \@@_tl_csname:n { \l_@@_rear_tl } } {##1} + \tl_set:cn + { \@@_tl_csname:n { \l_@@_rear_tl } } {##1} \tl_set:Nn \l_@@_rear_tl {##1} } } @@ -5703,42 +5787,50 @@ % {#3} % } % } -% \@@_debug:n { \@@_debug_label_data:N \l_@@_work_prop } +% \@@_debug:n +% { \@@_debug_label_data:N \l_@@_work_prop } % \tl_set:Nn \l_@@_rear_tl { 0 } % \tl_set:cn { \@@_tl_csname:n { 0 } } { 0 } % \seq_map_inline:Nn \l_@@_labels_seq % { -% \int_compare:nNnT { \cs:w \@@_tl_csname:n {##1} \cs_end: } = 0 -% { -% \tl_set:cn { \@@_tl_csname:n { \l_@@_rear_tl } }{##1} -% \tl_set:Nn \l_@@_rear_tl {##1} -% } +% \int_compare:nNnT +% { \cs:w \@@_tl_csname:n {##1} \cs_end: } = 0 +% { +% \tl_set:cn { \@@_tl_csname:n +% { \l_@@_rear_tl } } {##1} +% \tl_set:Nn \l_@@_rear_tl {##1} +% } % } % \tl_set_eq:Nc \l_@@_front_tl { \@@_tl_csname:n { 0 } } % \@@_tl_gclear:N #1 % \clist_gclear:N #2 -% \bool_while_do:nn { ! \str_if_eq_p:Vn \l_@@_front_tl { 0 } } +% \bool_while_do:nn +% { ! \str_if_eq_p:Vn \l_@@_front_tl { 0 } } % { % \int_decr:N \l_@@_labels_int -% \prop_get:NVN \l_@@_work_prop \l_@@_front_tl \l_@@_return_tl +% \prop_get:NVN \l_@@_work_prop +% \l_@@_front_tl \l_@@_return_tl % \exp_args:NNV \@@_tl_gput:Nn #1 \l_@@_return_tl % \@@_clist_gput:NV #2 \l_@@_front_tl -% \@@_debug:n{ \iow_term:x{Handled~ code~ for~ \l_@@_front_tl} } -% \seq_map_inline:cn { \@@_seq_csname:n { \l_@@_front_tl } } +% \@@_debug:n{ \iow_term:x +% {Handled~ code~ for~ \l_@@_front_tl} } +% \seq_map_inline:cn +% { \@@_seq_csname:n { \l_@@_front_tl } } % { % \tl_set:cx { \@@_tl_csname:n {##1} } -% { \int_eval:n -% { \cs:w \@@_tl_csname:n {##1} \cs_end: - 1 } -% } +% { \int_eval:n +% { \cs:w \@@_tl_csname:n {##1} \cs_end: - 1 } +% } % \int_compare:nNnT -% { \cs:w \@@_tl_csname:n {##1} \cs_end: } = 0 -% { -% \tl_set:cn { \@@_tl_csname:n { \l_@@_rear_tl } } {##1} -% \tl_set:Nn \l_@@_rear_tl {##1} -% } +% { \cs:w \@@_tl_csname:n {##1} \cs_end: } = 0 +% { +% \tl_set:cn { \@@_tl_csname:n +% { \l_@@_rear_tl } } {##1} +% \tl_set:Nn \l_@@_rear_tl {##1} +% } % } % \tl_set_eq:Nc \l_@@_front_tl -% { \@@_tl_csname:n { \l_@@_front_tl } } +% { \@@_tl_csname:n { \l_@@_front_tl } } % } % \int_compare:nNnF \l_@@_labels_int = 0 % { @@ -5747,7 +5839,8 @@ % \@@_debug_label_data:N \l_@@_work_prop % \iow_term:x{====================} % } -% \exp_args:NNo \@@_tl_gput:Nn #1 { \cs:w @@_toplevel~#3 \cs_end: } +% \exp_args:NNo \@@_tl_gput:Nn #1 +% { \cs:w @@_toplevel~#3 \cs_end: } % \@@_tl_gput_right:No #1 { \cs:w @@_next~#3 \cs_end: } % } %\cs_generate_variant:Nn \@@_tl_gput_right:Nn { No } @@ -6008,6 +6101,8 @@ % % \changes{v1.1a}{2023/04/06} % {Changes to add hook arguments (hook-args).} +% \changes{v1.1g}{2024/01/03} +% {Fix expansion of \cs{@@_print_args:nn} argument (gh/1221).} % \begin{macrocode} %\IncludeInRelease{2023/06/01}{\@@_log:nN} % {Hooks~with~args} @@ -6027,7 +6122,7 @@ hook~'#1' \@@_if_disabled:nF {#1} { - \exp_args:Nf \@@_print_args:nn {#1} + \exp_args:Nne \@@_print_args:nn {#1} { \int_eval:n { \str_count:e { \@@_parameter:n {#1} } / 3 } @@ -6164,7 +6259,8 @@ % } % \@@_preamble_hook:n {#1} % \@@_log_cmd:x -% { ^^J ->~The~ \@@_if_generic:nT {#1} { generic~ } hook~'#1': } +% { ^^J ->~The~ \@@_if_generic:nT +% {#1} { generic~ } hook~'#1': } % \@@_if_usable:nF {#1} % { \@@_log_line:x { The~hook~is~not~declared. } } % \@@_if_disabled:nT {#1} @@ -6177,26 +6273,30 @@ % { \@@_log_line_indent:x { --- } } % { % \prop_map_inline:cn { g_@@_#1_code_prop } -% { \@@_log_line_indent:x { ##1~->~\tl_to_str:n {##2} } } +% { \@@_log_line_indent:x +% { ##1~->~\tl_to_str:n {##2} } } % } % \@@_log_line:x % { % Document-level~(top-level)~code % \@@_if_usable:nT {#1} -% { ~(executed~\@@_if_reversed:nTF {#1} {first} {last} ) } : +% { ~(executed~ +% \@@_if_reversed:nTF {#1} {first} {last} ) } : % } % \@@_log_line_indent:x % { % \tl_if_empty:cTF { @@_toplevel~#1 } % { --- } -% { -> ~ \exp_args:Nv \tl_to_str:n { @@_toplevel~#1 } } +% { -> ~ \exp_args:Nv \tl_to_str:n +% { @@_toplevel~#1 } } % } % \@@_log_line:x { Extra~code~for~next~invocation: } % \@@_log_line_indent:x % { % \tl_if_empty:cTF { @@_next~#1 } % { --- } -% { ->~ \exp_args:Nv \@@_log_next_code:n { @@_next~#1 } } +% { ->~ \exp_args:Nv \@@_log_next_code:n +% { @@_next~#1 } } % } % \@@_log_line:x { Rules: } % \bool_set_true:N \l_@@_tmpa_bool @@ -6220,7 +6320,8 @@ % { % Execution~order % \bool_if:NTF \l_@@_tmpa_bool -% { \@@_if_reversed:nT {#1} { ~(after~reversal) } } +% { \@@_if_reversed:nT +% {#1}{ ~(after~reversal) } } % { ~(after~ % \@@_if_reversed:nT {#1} { reversal~and~ } % applying~rules) @@ -6231,16 +6332,19 @@ % \@spaces % \clist_if_empty:cTF { g_@@_#1_labels_clist } % { --- } -% { \clist_use:cn { g_@@_#1_labels_clist } { ,~ } } +% { \clist_use:cn +% { g_@@_#1_labels_clist } { ,~ } } % } % } % { % \@@_log_line:x { Execution~order: } % #2 % { -% \@spaces Not~set~because~the~hook~ \@@_if_usable:nTF {#1} +% \@spaces Not~set~because~the~hook~ +% \@@_if_usable:nTF {#1} % { code~pool~is~empty } -% { is~\@@_if_disabled:nTF {#1} {disabled} {undeclared} } +% { is~\@@_if_disabled:nTF +% {#1} {disabled} {undeclared} } % } % } % } @@ -6388,7 +6492,8 @@ %\IncludeInRelease{2020/10/01}{\hook_gput_next_code:nn} % {Hooks~with~args} %\cs_gset_protected:Npn \hook_gput_next_code:nn #1 -% { \@@_normalize_hook_args:Nn \@@_gput_next_code:nn {#1} } +% { \@@_normalize_hook_args:Nn +% \@@_gput_next_code:nn {#1} } %\cs_gset_protected:Npn \hook_gput_next_code_with_args:nn #1 #2 { } %\EndIncludeInRelease % \end{macrocode} @@ -6580,7 +6685,8 @@ % \fi: % \cs:w @@~#1 \@@_use_end: % } -%\cs_new:Npn \@@_use_undefined:w #1 #2 @@~#3 \@@_use_end: +%\cs_new:Npn \@@_use_undefined:w +% #1 #2 @@~#3 \@@_use_end: % { % #1 % fi % \@@_use:wn #3 / \s_@@_mark {#3} @@ -6680,15 +6786,18 @@ % % \changes{v1.0s}{2021/09/28} % {Correct usage of older \cs{@@_if_file_hook:wTF} (gh/675)} +% \changes{v1.1h}{2024/01/24} +% {Correct usage of older \cs{@@_if_file_hook:wTF} (gh/1243)} % \begin{macrocode} %\cs_new_protected:Npn \@@_try_file_hook:n #1 % { -% \@@_if_file_hook:wTF #1 / \s_@@_mark +% \@@_if_file_hook:wTF #1 / / \s_@@_mark % { % \exp_args:Ne \@@_if_usable_use:n % { \exp_args:Ne \@@_file_hook_normalize:n {#1} } % } -% { \@@_if_usable_use:n {#1} } % file/ generic hook (e.g. file/before) +% { \@@_if_usable_use:n {#1} } +% % file/ generic hook (e.g. file/before) % } % \end{macrocode} % @@ -6726,12 +6835,14 @@ \cs_new_protected:Npn \hook_use_once:n #1 { \@@_if_execute_immediately:nF {#1} - { \@@_normalize_hook_args:Nn \@@_use_once:nn { \use:n {#1} } { 0 } } + { \@@_normalize_hook_args:Nn \@@_use_once:nn + { \use:n {#1} } { 0 } } } \cs_new_protected:Npn \hook_use_once:nnw #1 #2 { \@@_if_execute_immediately:nF {#1} - { \@@_normalize_hook_args:Nn \@@_use_once:nn { \use:n {#1} } {#2} } + { \@@_normalize_hook_args:Nn \@@_use_once:nn + { \use:n {#1} } {#2} } } %\EndIncludeInRelease % \end{macrocode} @@ -6743,7 +6854,8 @@ %\cs_gset_protected:Npn \hook_use_once:n #1 % { % \@@_if_execute_immediately:nF {#1} -% { \@@_normalize_hook_args:Nn \@@_use_once:n { \use:n {#1} } } +% { \@@_normalize_hook_args:Nn \@@_use_once:n +% { \use:n {#1} } } % } %\cs_gset:Npn \hook_use_once:nnw #1 #2 % { \use:c { use_none: \prg_replicate:nn {#2} { n } } } @@ -6768,7 +6880,8 @@ % along with the next execution code. % \begin{macrocode} \@@_replacing_args_false: - \@@_cs_gput_right:nnn { _next } {#1} { \@@_use_once_clear:n {#1} } + \@@_cs_gput_right:nnn { _next } {#1} + { \@@_use_once_clear:n {#1} } \@@_replacing_args_reset: \@@_if_usable:nTF {#1} { \@@_use_initialized:n {#1} } @@ -7215,7 +7328,8 @@ { Cannot~add~code~to~disabled~hook~'#1'. } { The~hook~'#1'~you~tried~to~add~code~to~was~previously~disabled~ - with~\iow_char:N\\hook_disable_generic:n~or~\iow_char:N\\DisableGenericHook,~so~ + with~\iow_char:N\\hook_disable_generic:n~or~ + \iow_char:N\\DisableGenericHook,~so~ it~cannot~have~code~added~to~it. } % \end{macrocode} @@ -7383,7 +7497,7 @@ % {Hooks~with~args} %\cs_new_protected:Npn \NewHookWithArguments #1 #2 { } %\cs_new_protected:Npn \NewReversedHookWithArguments #1 #2 { } -%\cs_new_protected:Npn \NewMirroredHookPairWithArguments #1 #2 #3 { } +%\cs_new_protected:Npn \NewMirroredHookPairWithArguments #1 #2 #3{} %\EndIncludeInRelease % \end{macrocode} % \end{macro} @@ -7835,7 +7949,8 @@ % \exp_args:No \exp_not:o % { % \cs:w @@#1~#2 \exp_last_unbraced:Ne \cs_end: -% { \@@_braced_cs_parameter:n { @@#1~#2 } } +% { \@@_braced_cs_parameter:n +% { @@#1~#2 } } % } % } % } -- cgit v1.2.3