[latex3-commits] [git/LaTeX3-latex3-latex2e] lthooks2: part of acc118 (f77a0079)

Frank Mittelbach frank.mittelbach at latex-project.org
Wed Aug 19 18:08:09 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : lthooks2
Link       : https://github.com/latex3/latex2e/commit/f77a0079e260822da15120e0ea4e326853c7855f

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

commit f77a0079e260822da15120e0ea4e326853c7855f
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Wed Aug 19 18:08:09 2020 +0200

    part of acc118


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

f77a0079e260822da15120e0ea4e326853c7855f
 base/lthooks.dtx   | 53 ++++++++++++++++++++---------------------------------
 base/ltshipout.dtx |  3 ++-
 2 files changed, 22 insertions(+), 34 deletions(-)

diff --git a/base/lthooks.dtx b/base/lthooks.dtx
index 2a68de5b..b2e3e2c2 100644
--- a/base/lthooks.dtx
+++ b/base/lthooks.dtx
@@ -1,5 +1,5 @@
 % \iffalse meta-comment
-%
+%%
 %% File: lthooks.dtx (C) Copyright 2020 Frank Mittelbach,
 %%                                      Phelype Oleinik & LaTeX Team
 %
@@ -1227,13 +1227,14 @@
 % \subsubsection{Hooks provided by \cs{begin}\texttt{\{document\}}}
 %
 %    Until 2020 \cs{begin}\texttt{\{document\}} offered exactly one
-%    hook that one had to fill using \cs{AtBeginDocument}. Experience
-%    has shown that this single hook in one place was not enough and
-%    as part of adding the general hook management system a number of
-%    additional hooks have been added at this point. The places for
-%    hooks have been chosen to provide the same support as offered by
-%    external packages, such as \pkg{etoolbox} and others that
-%    augmented \cs{document} to gain better control.
+%    hook that one could add to using
+%    \cs{AtBeginDocument}. Experiences over the years have shown that
+%    this single hook in one place was not enough and as part of
+%    adding the general hook management system a number of additional
+%    hooks have been added at this point. The places for these hooks have
+%    been chosen to provide the same support as offered by external
+%    packages, such as \pkg{etoolbox} and others that augmented
+%    \cs{document} to gain better control.
 %
 %    Supported are now the following hooks (all of them one-time hooks):
 %    \begin{description}
@@ -1257,6 +1258,11 @@
 %      initializations that shouldn't be altered and are therefore
 %      coming later.
 %
+%      This hook should not be used to add material for typesetting as
+%      we are still in \LaTeX's initialization phase and not in the
+%      document body. If such material needs to be added to the document
+%      body use the next hook instead.
+%
 %    \item[\hook{begindocument/end}]
 %
 %      This hook is executed at the end of the \cs{document} code in
@@ -3507,33 +3513,14 @@
 %   default label for the top-level.  Since the string \verb|top-level|
 %   is hardcoded, here this item of the stack is empty.  Also, since
 %   we're in an input level, add \verb|lthooks| to the stack as well.
-%   This stack should never go empty, so we loop through \LaTeXe's
-%   file name stack, and add empty entries to \cs{g_@@_name_stack_seq}
-%   for each item in that stack.  The last item is the \verb|top-level|,
-%   which also gets an empty entry.
-%
-% \fmi{Fix this no longer applies, so it is unnecessary code}
-%
-%   Also check for the case we're loading \texttt{lthooks} in the
-%   \LaTeXe{} kernel.  In that case, \cs{@currname} isn't \verb|lthooks|
-%   and just the top-level is added to the stack as an empty entry.
+%   This stack should never go empty.  An empty entry is added to the
+%   stack to account for the \verb|top-level|.  The item is empty so
+%   that the hard-coded default is used, but a call to
+%   \cs{DeclareDefaultHookLabel} will change it if needed.
 %    \begin{macrocode}
-\str_if_eq:VnTF \@currname { lthooks }
-  {
-    \seq_gpush:Nn \g_@@_name_stack_seq { lthooks }
-    \cs_set_protected:Npn \@@_tmp:w #1 #2 #3
-      {
-        \quark_if_recursion_tail_stop:n {#1}
-        \seq_gput_right:Nn \g_@@_name_stack_seq { }
-        \@@_tmp:w
-      }
-    \exp_after:wN \@@_tmp:w
-      \@currnamestack
-      \q_recursion_tail \q_recursion_tail
-      \q_recursion_tail \q_recursion_stop
-  }
-  { \seq_gpush:Nn \g_@@_name_stack_seq { } }
+\seq_gpush:Nn \g_@@_name_stack_seq { }
 %    \end{macrocode}
+
 %
 %   Two commands keep track of the stack: when a file is input,
 %   \cs{@@_curr_name_push:n} pushes an (empty by default) label to the
diff --git a/base/ltshipout.dtx b/base/ltshipout.dtx
index 017fb61a..57a6ba83 100644
--- a/base/ltshipout.dtx
+++ b/base/ltshipout.dtx
@@ -1,6 +1,7 @@
 % \iffalse meta-comment
-%
+%%
 %% File: ltshipout.dtx (C) Copyright 2020 Frank Mittelbach, LaTeX Team
+%%
 %
 % This file is part of the LaTeX base system.
 % -------------------------------------------





More information about the latex3-commits mailing list.