[latex3-commits] [git/LaTeX3-latex3-latex2e] ProvideHook: Added \ProvideHook and friends; Changed error and wanring messages to kernel versions (708a1b98)

Frank Mittelbach frank.mittelbach at latex-project.org
Thu Apr 29 23:52:16 CEST 2021


Repository : https://github.com/latex3/latex2e
On branch  : ProvideHook
Link       : https://github.com/latex3/latex2e/commit/708a1b98a28b3d877ff326dfd8b43e6872ac142d

>---------------------------------------------------------------

commit 708a1b98a28b3d877ff326dfd8b43e6872ac142d
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Thu Apr 29 23:52:16 2021 +0200

    Added \ProvideHook and friends;
    Changed error and wanring messages to kernel versions


>---------------------------------------------------------------

708a1b98a28b3d877ff326dfd8b43e6872ac142d
 base/changes.txt                          | 11 +++++++++++
 base/ltcmdhooks.dtx                       | 21 +++++++++++++--------
 base/lthooks.dtx                          |  1 +
 base/testfiles-lthooks/lthooks-errors.tlg | 10 +++++-----
 4 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index f74fbd0f..75e7d04a 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,17 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 ================================================================================
 
+2021-04-29  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* lthooks.dtx (subsection{\LaTeXe{} package interface commands}):
+	Add \ProvideHook and related commands.
+
+2021-04-29  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* lthooks.dtx, ltfilehook.dtx:
+	Switch to kernel (not package) errors.
+
+
 2021-04-29  Marcel Krüger  <Marcel.Krueger at latex-project.org>
 
 	* ltoutenc.dtx (subsection{Definitions for the TU encoding}):
diff --git a/base/ltcmdhooks.dtx b/base/ltcmdhooks.dtx
index 30d6e977..294dd611 100644
--- a/base/ltcmdhooks.dtx
+++ b/base/ltcmdhooks.dtx
@@ -196,11 +196,11 @@
 %
 % \section{Package Author Interface}
 %
-% \hook{cmd} hooks are, by default, available for all commands that can
-% be patched to add the hooks.  For some commands, however, the very
-% beginning or the very end of the code is not the best place to put the
-% hooks, for example, if the command looks ahead for arguments
-% (see section~\ref{sec:look-ahead}).
+% The \hook{cmd} hooks are, by default, available for all commands
+% that can be patched to add the hooks.  For some commands, however,
+% the very beginning or the very end of the code is not the best place
+% to put the hooks, for example, if the command looks ahead for
+% arguments (see section~\ref{sec:look-ahead}).
 %
 % If you are a package author and you want to add the hooks to your
 % own commands in the proper position you can define the command and
@@ -245,9 +245,14 @@
 %
 % Alternatively, if for whatever reason your command does not support
 % the generic hooks provided here, you can disable a hook with
-% \cs{DisableHook}, so that when someone tries to add code to it they
-% will get an error.  Or if you don't want the error, you can simply
-% declare the hook with \cs{NewHook} and never use it.
+% \cs{DisableHook}\footnote{Please use \cs{DisableHook} if at all, only
+% on hooks that you \enquote{own}, i.e., for commands that your
+% package or class defines and not second guess
+% whether or not hooks of other packages should get disabled!}, so
+% that when someone tries to add code to it they will get an error.
+% Or if you don't want the error, you can simply declare the hook with
+% \cs{NewHook} and never use it.
+%
 %
 % The above approach is useful for really complex commands where for
 % one or the other reason the hooks can't be placed at the very
diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 2a7d6003..b9866bf7 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -4721,6 +4721,7 @@
 %
 %  \begin{macro}{\ProvideHook,\ProvideReversedHook,\ProvideMirroredHookPair}
 %    Providing new hooks \ldots
+% \changes{v1.0m}{2021/04/29}{Add \cs{ProvideHook} etc.}
 %    \begin{macrocode}
 \NewDocumentCommand \ProvideHook         { m }{ \hook_provide:n {#1} }
 \NewDocumentCommand \ProvideReversedHook { m }{ \hook_provide_reversed:n {#1} }
diff --git a/base/testfiles-lthooks/lthooks-errors.tlg b/base/testfiles-lthooks/lthooks-errors.tlg
index 11b43855..15935e1b 100644
--- a/base/testfiles-lthooks/lthooks-errors.tlg
+++ b/base/testfiles-lthooks/lthooks-errors.tlg
@@ -33,13 +33,13 @@ incompatibility between packages.
 >     label5|label1 with relation xE
 > Execution order (after applying rules):
 >     label1, label2, label3, label4, label5.
-! LaTeX3 Error: Unknown message 'should-not-happen' for module 'hooks'.
-For immediate help type H <return>.
+! LaTeX3 Error: ERROR! This should not happen. Tried to pop from an empty file
+(LaTeX3)        name stack.
+(LaTeX3)        Please report at https://github.com/latex3/latex2e.
+Type <return> to continue.
  ...                                              
 l. ...\@expl@@@filehook at file@pop@@
-This is a coding error.
-LaTeX was asked to display a message called 'should-not-happen'
-by the module 'hooks': this message does not exist.
+LaTeX does not know anything more about this error, sorry.
 Try typing <return> to proceed.
 If that doesn't work, type X <return> to quit.
 ! LaTeX3 Error: You cannot change the default label for `top-level'. Illegal





More information about the latex3-commits mailing list.