summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/base/ltcmdhooks.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-06-02 20:26:39 +0000
committerKarl Berry <karl@freefriends.org>2024-06-02 20:26:39 +0000
commitb0c666dbd315af330424f5d34739d7d4134d0c17 (patch)
tree0b0a60149691348e9cea719bb797b2c1587adfc6 /Master/texmf-dist/source/latex/base/ltcmdhooks.dtx
parent5634f0473d32ab71b4fbaaf0a6870737c2cc6dcb (diff)
latex2e (2jun24)
git-svn-id: svn://tug.org/texlive/trunk@71408 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/base/ltcmdhooks.dtx')
-rw-r--r--Master/texmf-dist/source/latex/base/ltcmdhooks.dtx46
1 files changed, 30 insertions, 16 deletions
diff --git a/Master/texmf-dist/source/latex/base/ltcmdhooks.dtx b/Master/texmf-dist/source/latex/base/ltcmdhooks.dtx
index 73bd7f63518..f8a8699d7ed 100644
--- a/Master/texmf-dist/source/latex/base/ltcmdhooks.dtx
+++ b/Master/texmf-dist/source/latex/base/ltcmdhooks.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: ltcmdhooks.dtx
+%% From File: ltcmdhooks.dtx
%% Copyright (C) 2020-2024
%% Frank Mittelbach, Phelype Oleinik, The LaTeX Project
%
@@ -12,16 +12,20 @@
% https://www.latex-project.org/lppl.txt
%
%
-%%% From File: ltcmdhooks.dtx
-%
-\def\ltcmdhooksversion{v1.0i}
-\def\ltcmdhooksdate{2023/06/16}
-%
+% \fi
%
+% \iffalse
+%%% From File: lthooks.dtx
%
%<*driver>
+% \fi
+\ProvidesFile{ltcmdhooks.dtx}
+ [2024/04/17 v1.0j LaTeX Kernel (Command hooks)]
+% \iffalse
+%
\documentclass{l3doc}
-%\usepackage{ltcmdhooks}
+\GetFileInfo{ltcmdhooks.dtx}
+% \usepackage{ltcmdhooks}
\EnableCrossrefs
\CodelineIndex
\begin{document}
@@ -38,7 +42,7 @@
% \providecommand\phoinline[1]{\begin{quote}\itshape\footnotesize PhO: #1\end{quote}}
%
% \title{The \texttt{ltcmdhooks} module\thanks{This file has version
-% \ltcmdhooksversion\ dated \ltcmdhooksdate, \copyright\ \LaTeX\
+% \fileversion\ dated \filedate, \copyright\ \LaTeX\
% Project.}}
% \author{Frank Mittelbach \and Phelype Oleinik}
%
@@ -125,8 +129,8 @@
% \item
%
% that code can be prepended or appended (i.e., added to the
-% hooks) even if the command itself is not defined, because the
-% defining package has not yet been loaded;
+% hooks) even if the command itself is not (yet) defined, because the
+% defining package has not been loaded at this point;
%
% \item
%
@@ -214,6 +218,14 @@
% optional and mandatory arguments. By adding code to the
% \hook{cmd/section/after} hook, you get in the way of that scanning.
%
+% In such a case, where it is known that a specific generic command
+% hook does not work if code is added to it, the package author can
+% add a \cs{DisableGenericHook}\footnote{Please use
+% \cs{DisableGenericHook} if at all, only on hooks that you
+% \enquote{own}, i.e., for commands your package or class defines and
+% not second guess whether or not hooks of other packages should get
+% disabled!} declaration to prevent this from happening in user
+% documents and thereby avoiding obscure errors.
%
%
% \section{Package Author Interface}
@@ -394,6 +406,8 @@
% \end{macrocode}
%
% \changes{v1.0b}{2021/05/24}{Use \cs{msg_...} instead of \cs{__kernel_msg...}}
+% \changes{v1.0j}{2024/04/17}{Use \cs{__kernel_cs_parameter_spec:N} instead
+% of \cs{cs_argument_spec:N}/\cs{cs_parameter_spec:N}}
%
% \begin{macrocode}
%<*2ekernel|latexrelease>
@@ -643,7 +657,7 @@
}
}
% \end{macrocode}
-% and a conditional \cs{@@_if_public_command:N} to check if a command
+% and a conditional \cs{@@_if_public_command:NTF} to check if a command
% has |__| in its name (no other checking is performed). Primitives
% with |:D| in their name could be included here, but they are already
% discarded in the \cs{token_if_macro:NTF} test above.
@@ -838,14 +852,14 @@
\@@_patch_debug:x { ++~command~can~be~patched~without~rescanning }
% \end{macrocode}
% We'll start by counting the number of arguments in the command by
-% counting the number of characters in the \cs{cs_argument_spec:N} of
+% counting the number of characters in the \cs{cs_parameter_spec:N} of
% the macro, divided by two, and subtracting one if the command has an
% optional argument (that is, an extra |[]| in its
% \meta{parameter text}).
% \begin{macrocode}
\int_set:Nn \l_@@_patch_num_args_int
{
- \exp_args:Nf \str_count:n { \cs_argument_spec:N #2 } / 2
+ \exp_args:Nf \str_count:n { \__kernel_cs_parameter_spec:N #2 } / 2
\bool_if:NT #1 { -1 }
}
% \end{macrocode}
@@ -998,7 +1012,7 @@
%<latexrelease> \@@_patch_debug:x { ++~command~can~be~patched~without~rescanning }
%<latexrelease> \int_set:Nn \l_@@_patch_num_args_int
%<latexrelease> {
-%<latexrelease> \exp_args:Nf \str_count:n { \cs_argument_spec:N #2 } / 2
+%<latexrelease> \exp_args:Nf \str_count:n { \__kernel_cs_parameter_spec:N #2 } / 2
%<latexrelease> \bool_if:NT #1 { -1 }
%<latexrelease> }
%<latexrelease> \int_compare:nNnTF { \l_@@_patch_num_args_int } > { \c_zero_int }
@@ -1248,12 +1262,12 @@
% top-level macro with no arguments, so testing this first would
% short-circuit \tn{robust@command@act} and the top-level macros would
% be incorrectly patched. In that case, we just check if the
-% \cs{cs_argument_spec:N} is empty, and call
+% \cs{cs_parameter_spec:N} is empty, and call
% \cs{@@_patch_expand_redefine:NNnn}.
% \begin{macrocode}
\cs_new_protected:Npn \@@_retokenize_patch:Nnn #1 #2 #3
{
- \str_if_eq:eeTF { \cs_argument_spec:N #1 } { }
+ \str_if_eq:eeTF { \__kernel_cs_parameter_spec:N #1 } { }
{ \@@_patch_expand_redefine:NNnn \c_false_bool #1 {#2} {#3} }
{
\@@_patch_debug:x { ..~command~can~only~be~patched~by~rescanning }