Skip to content

Commit

Permalink
\DisableHook -> \DisableGenericHook
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankMittelbach committed Aug 1, 2021
1 parent 0b7a68e commit ee18fc4
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 28 deletions.
16 changes: 8 additions & 8 deletions base/lthooks.dtx
Expand Up @@ -180,15 +180,15 @@
% \end{function}
%
%
% \subsubsection{Special declarations for hooks}
% \subsubsection{Special declarations for generic hooks}
%
% The declarations here should normally not be used. They are available
% to provide support for special use cases mainly involving
% generic command hooks.
%
% \begin{function}{\DisableHook}
% \begin{function}{\DisableGenericHook}
% \begin{syntax}
% \cs{DisableHook} \Arg{hook}
% \cs{DisableGenericHook} \Arg{hook}
% \end{syntax}
% After this declaration the \meta{hook} is no longer usable: Any
% attempt to add further code to it will result in an error and any
Expand Down Expand Up @@ -2260,7 +2260,7 @@
% \item[disabled]
%
% A hook in any state is moved to this state when
% \cs{DisableHook} is used. This changes the tests to give the
% \cs{DisableGenericHook} is used. This changes the tests to give the
% following results:
% \begin{itemize}
% \item [@@_if_structure_exist:nTF] \emph{unchanged}.
Expand Down Expand Up @@ -4654,7 +4654,7 @@
{ 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:n~or~\iow_char:N\\DisableHook,~so~
with~\iow_char:N\\hook_disable:n~or~\iow_char:N\\DisableGenericHook,~so~
it~cannot~have~code~added~to~it.
}
% \end{macrocode}
Expand Down Expand Up @@ -4797,10 +4797,10 @@
% \end{macro}
%
%
% \begin{macro}{\DisableHook}
% \begin{macro}{\DisableGenericHook}
% Disabling a (generic) hook.
% \begin{macrocode}
\NewDocumentCommand \DisableHook { m }{ \hook_disable:n {#1} }
\NewDocumentCommand \DisableGenericHook { m }{ \hook_disable:n {#1} }
% \end{macrocode}
% \end{macro}
%
Expand Down Expand Up @@ -5156,7 +5156,7 @@
%<latexrelease>\def \NewReversedHook#1{}
%<latexrelease>\def \NewMirroredHookPair#1#2{}
%<latexrelease>
%<latexrelease>\def \DisableHook #1{}
%<latexrelease>\def \DisableGenericHook #1{}
%<latexrelease>
%<latexrelease>\long\def\AddToHookNext#1#2{}
%<latexrelease>
Expand Down
12 changes: 6 additions & 6 deletions base/testfiles-lthooks/ltcmdhooks-008.lvt
Expand Up @@ -11,32 +11,32 @@
\def\foo{foo}

\AddToHook{\foo}{before} \ShowHook{\foo}
\DisableHook{\foo} \ShowHook{\foo}
\DisableGenericHook{\foo} \ShowHook{\foo}
\AddToHook{\foo}{after} \ShowHook{\foo}

\typeout{=================================}
\def\foo{bar}

\AddToHook{\foo}{before} \ShowHook{\foo}
\NewHook{\foo} \ShowHook{\foo}
\DisableHook{\foo} \ShowHook{\foo}
\DisableGenericHook{\foo} \ShowHook{\foo}

\typeout{=================================}
\def\foo{baz}

\DisableHook{\foo} \ShowHook{\foo}
\DisableGenericHook{\foo} \ShowHook{\foo}
\AddToHookNext{\foo}{after} \ShowHook{\foo}

\typeout{=================================}
\def\foo{env/foo/before}

\DisableHook{\foo} \ShowHook{\foo}
\DisableGenericHook{\foo} \ShowHook{\foo}
\AddToHookNext{\foo}{after} \ShowHook{\foo}

\typeout{=================================}
\def\foo{cmd/test/before}

\DisableHook{\foo} \ShowHook{\foo}
\DisableGenericHook{\foo} \ShowHook{\foo}
\AddToHook{\foo}{after} \ShowHook{\foo}

\typeout{=================================}
Expand All @@ -53,7 +53,7 @@
\ShowHook{\foo}

% This won't work, so we disable...
\DisableHook{\foo}
\DisableGenericHook{\foo}

% ... and try adding even more code nonetheless :)
\AddToHook{\foo}{\ERROR 3}
Expand Down
23 changes: 13 additions & 10 deletions base/testfiles-lthooks/ltcmdhooks-008.tlg
Expand Up @@ -29,14 +29,14 @@ l. ...\AddToHook{\foo}{before} \ShowHook{\foo}
> Execution order:
> Not set because the hook is disabled.
<recently read> }
l. ...\DisableHook{\foo} \ShowHook{\foo}
l. ......GenericHook{\foo} \ShowHook{\foo}
! LaTeX hooks Error: Cannot add code to disabled hook 'foo'.
For immediate help type H <return>.
...
l. ...\AddToHook{\foo}{after}
\ShowHook{\foo}
The hook 'foo' you tried to add code to was previously disabled with
\hook_disable:n or \DisableHook, so it cannot have code added to it.
\hook_disable:n or \DisableGenericHook, so it cannot have code added to it.
-> The hook 'foo':
> The hook is not declared.
> The hook is disabled.
Expand Down Expand Up @@ -94,21 +94,21 @@ l. ...\NewHook{\foo} \ShowHook{\foo}
> Execution order:
> Not set because the hook is disabled.
<recently read> }
l. ...\DisableHook{\foo} \ShowHook{\foo}
l. ......GenericHook{\foo} \ShowHook{\foo}
=================================
-> The hook 'baz':
> The hook is not declared.
> The hook is disabled.
> The hook is empty.
<recently read> }
l. ...\DisableHook{\foo} \ShowHook{\foo}
l. ......GenericHook{\foo} \ShowHook{\foo}
! LaTeX hooks Error: Cannot add code to disabled hook 'baz'.
For immediate help type H <return>.
...
l. ...\AddToHookNext{\foo}{after}
\ShowHook{\foo}
The hook 'baz' you tried to add code to was previously disabled with
\hook_disable:n or \DisableHook, so it cannot have code added to it.
\hook_disable:n or \DisableGenericHook, so it cannot have code added to it.
-> The hook 'baz':
> The hook is not declared.
> The hook is disabled.
Expand All @@ -121,14 +121,15 @@ l. ...\AddToHookNext{\foo}{after} \ShowHook{\foo}
> The hook is disabled.
> The hook is empty.
<recently read> }
l. ...\DisableHook{\foo} \ShowHook{\foo}
l. ......GenericHook{\foo} \ShowHook{\foo}
! LaTeX hooks Error: Cannot add code to disabled hook 'env/foo/before'.
For immediate help type H <return>.
...
l. ...\AddToHookNext{\foo}{after}
\ShowHook{\foo}
The hook 'env/foo/before' you tried to add code to was previously disabled
with \hook_disable:n or \DisableHook, so it cannot have code added to it.
with \hook_disable:n or \DisableGenericHook, so it cannot have code added to
it.
-> The hook 'env/foo/before':
> The hook is not declared.
> The hook is disabled.
Expand All @@ -141,14 +142,15 @@ l. ...\AddToHookNext{\foo}{after} \ShowHook{\foo}
> The hook is disabled.
> The hook is empty.
<recently read> }
l. ...\DisableHook{\foo} \ShowHook{\foo}
l. ......GenericHook{\foo} \ShowHook{\foo}
! LaTeX hooks Error: Cannot add code to disabled hook 'cmd/test/before'.
For immediate help type H <return>.
...
l. ...\AddToHook{\foo}{after}
\ShowHook{\foo}
The hook 'cmd/test/before' you tried to add code to was previously disabled
with \hook_disable:n or \DisableHook, so it cannot have code added to it.
with \hook_disable:n or \DisableGenericHook, so it cannot have code added to
it.
-> The hook 'cmd/test/before':
> The hook is not declared.
> The hook is disabled.
Expand All @@ -174,7 +176,8 @@ For immediate help type H <return>.
...
l. ...\AddToHook{\foo}{\ERROR 3}
The hook 'cmd/mycmd/after' you tried to add code to was previously disabled
with \hook_disable:n or \DisableHook, so it cannot have code added to it.
with \hook_disable:n or \DisableGenericHook, so it cannot have code added to
it.
-> The hook 'cmd/mycmd/after':
> The hook is not declared.
> The hook is disabled.
Expand Down
2 changes: 1 addition & 1 deletion base/testfiles-lthooks/lthooks-029.lvt
Expand Up @@ -68,7 +68,7 @@

\typeout{------------ provide hook that was disabled --------------}

\DisableHook{ddd}
\DisableGenericHook{ddd}
\ProvideHook{ddd}
\ShowHook{ddd}

Expand Down
2 changes: 1 addition & 1 deletion base/testfiles-lthooks/lthooks-errors.lvt
Expand Up @@ -22,7 +22,7 @@

% provide-error
\ProvideHook{yyy}
\DisableHook{yyy}
\DisableGenericHook{yyy}

% provide-disabled
\ProvideHook{yyy}
Expand Down
4 changes: 2 additions & 2 deletions base/testfiles-lthooks/lthooks-errors.tlg
Expand Up @@ -24,7 +24,7 @@ For immediate help type H <return>.
...
l. ...\AddToHook{yyy}{error}
The hook 'yyy' you tried to add code to was previously disabled with
\hook_disable:n or \DisableHook, so it cannot have code added to it.
\hook_disable:n or \DisableGenericHook, so it cannot have code added to it.
! Undefined control sequence.
<argument> \::error
! hooks: Empty code label on line .... Using 'top-level' ...
Expand All @@ -39,7 +39,7 @@ For immediate help type H <return>.
...
l. ...\AddToHook{yyy}[]{error}
The hook 'yyy' you tried to add code to was previously disabled with
\hook_disable:n or \DisableHook, so it cannot have code added to it.
\hook_disable:n or \DisableGenericHook, so it cannot have code added to it.
! LaTeX hooks Error: Missing (empty) default label on line ....
(hooks) This command was ignored.
Type <return> to continue.
Expand Down

0 comments on commit ee18fc4

Please sign in to comment.