texlive[56324] Master/texmf-dist: latex-base-dev (10sep20)

commits+karl at tug.org commits+karl at tug.org
Fri Sep 11 22:57:30 CEST 2020


Revision: 56324
          http://tug.org/svn/texlive?view=revision&revision=56324
Author:   karl
Date:     2020-09-11 22:57:29 +0200 (Fri, 11 Sep 2020)
Log Message:
-----------
latex-base-dev (10sep20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex-dev/base/README.md
    trunk/Master/texmf-dist/doc/latex-dev/base/alltt.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/cfgguide.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/changes.txt
    trunk/Master/texmf-dist/doc/latex-dev/base/classes.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/clsguide.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/cmfonts.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/cyrguide.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/doc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/docstrip.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/encguide.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/exscale.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/fix-cm.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/fntguide.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/graphpap.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ifthen.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/inputenc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/latexchanges.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/latexrelease.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/latexsym.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/lb2.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/letter.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/lgc2.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/lppl.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltfilehook-code.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltfilehook-doc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/lthooks-code.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/lthooks-doc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltluatex.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews01.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews02.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews03.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews04.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews05.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews06.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews07.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews08.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews09.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews10.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews11.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews12.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews13.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews14.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews15.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews16.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews17.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews18.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews19.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews20.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews21.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews22.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews23.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews24.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews25.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews26.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews27.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews28.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews29.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews30.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews31.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltnews32.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltshipout-code.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltshipout-doc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltx3info.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/ltxdoc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/makeindx.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/manual.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/modguide.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/nfssfont.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/proc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/slides.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/slifonts.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/source2e.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/syntonly.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/tlc2.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/tulm.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/usrguide.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/utf8ienc.pdf
    trunk/Master/texmf-dist/doc/latex-dev/base/webcomp.pdf
    trunk/Master/texmf-dist/source/latex-dev/base/ltclass.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltdefns.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltexpl.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltfilehook.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/lthooks.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx
    trunk/Master/texmf-dist/source/latex-dev/base/ltvers.dtx
    trunk/Master/texmf-dist/tex/latex-dev/base/atbegshi-ltx.sty
    trunk/Master/texmf-dist/tex/latex-dev/base/atveryend-ltx.sty
    trunk/Master/texmf-dist/tex/latex-dev/base/everyshi-ltx.sty
    trunk/Master/texmf-dist/tex/latex-dev/base/filehook-ltx.sty
    trunk/Master/texmf-dist/tex/latex-dev/base/latex.ltx
    trunk/Master/texmf-dist/tex/latex-dev/base/latexrelease.sty
    trunk/Master/texmf-dist/tex/latex-dev/base/srclfile-ltx.sty
    trunk/Master/texmf-dist/tex/latex-dev/base/structuredlog.sty

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/README.md	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/README.md	2020-09-11 20:57:29 UTC (rev 56324)
@@ -1,7 +1,7 @@
 The LaTeX kernel
 ================
 
-Release 2020-10-01 pre-release 8
+Release 2020-10-01 pre-release 9
 
 Overview
 --------

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/alltt.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/cfgguide.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/changes.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex-dev/base/changes.txt	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/doc/latex-dev/base/changes.txt	2020-09-11 20:57:29 UTC (rev 56324)
@@ -6,6 +6,16 @@
 are not part of the distribution.
 ================================================================================
 
+2020-09-09  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* ltshipout.dtx (subsection{Emulating \pkg{atbegshi}}):
+	Avoid unnecessary overfull box warnings (gh/387)
+
+2020-09-06  Phelype Oleinik  <phelype.oleinik at latex-project.org>
+
+	* ltclass.dtx:
+	Correct option passing when a file is replaced
+
 2020-08-24  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
 	* ltfssini.dtx:

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/classes.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/clsguide.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/cmfonts.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/cyrguide.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/docstrip.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/encguide.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/exscale.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/fix-cm.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/fntguide.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/graphpap.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ifthen.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/inputenc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/latexchanges.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/latexrelease.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/latexsym.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/lb2.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/letter.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/lgc2.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/lppl.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltfilehook-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltfilehook-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/lthooks-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/lthooks-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltluatex.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews01.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews02.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews03.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews04.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews05.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews06.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews07.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews08.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews09.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews10.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews11.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews12.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews13.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews14.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews15.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews16.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews17.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews18.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews19.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews20.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews21.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews22.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews23.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews24.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews25.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews26.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews27.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews28.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews29.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews30.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews31.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltnews32.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltshipout-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltshipout-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltx3info.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/ltxdoc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/makeindx.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/manual.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/modguide.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/nfssfont.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/proc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/slides.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/slifonts.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/source2e.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/syntonly.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/tlc2.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/tulm.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/usrguide.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/utf8ienc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex-dev/base/webcomp.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltclass.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltclass.dtx	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltclass.dtx	2020-09-11 20:57:29 UTC (rev 56324)
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltclass.dtx}
-             [2020/08/29 v1.3p LaTeX Kernel (Class & Package Interface)]
+             [2020/09/06 v1.3q LaTeX Kernel (Class & Package Interface)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltclass.dtx}
@@ -1021,11 +1021,28 @@
 % If the package has been loaded, we check that it was first loaded with
 % the options.  Otherwise we add the option list to that of the package.
 %    \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2020/10/01}{\@pass at ptions}
+%<latexrelease>  {Add file replacement in \@pass at ptions}%
+%<*2ekernel|latexrelease>
 \def\@pass at ptions#1#2#3{%
-  \expandafter\xdef\csname opt@#3.#1\endcsname{%
-    \@ifundefined{opt@#3.#1}\@empty
-      {\csname opt@#3.#1\endcsname,}%
+  \edef\reserved at a{\@expl@@@filehook at resolve@file at subst@@w #3.#1\@nil}%
+  \expandafter\xdef\csname opt@\reserved at a\endcsname{%
+    \@ifundefined{opt@\reserved at a}\@empty
+      {\csname opt@\reserved at a\endcsname,}%
     \zap at space#2 \@empty}}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%
+%<latexrelease>\IncludeInRelease{0000/00/00}{\@pass at ptions}
+%<latexrelease>  {\@pass at ptions}%
+%<latexrelease>\def\@pass at ptions#1#2#3{%
+%<latexrelease>  \expandafter\xdef\csname opt@#3.#1\endcsname{%
+%<latexrelease>    \@ifundefined{opt@#3.#1}\@empty
+%<latexrelease>      {\csname opt@#3.#1\endcsname,}%
+%<latexrelease>    \zap at space#2 \@empty}}
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
 \@onlypreamble\@pass at ptions
 %    \end{macrocode}
 %
@@ -1633,8 +1650,6 @@
 \@onlypreamble\@fileswith at pti@ns
 %    \end{macrocode}
 %
-
-
 % \begin{macro}{\load at onefilewithoptions}
 %   This macro is used when loading packages or classes.
 %
@@ -1727,6 +1742,29 @@
          {\@expl@@@filehook at file@push@@
           \set at curr@file{\@currname.\@currext}%
           \@filehook at set@CurrentFile
+%    \end{macrocode}
+%    \changes{v1.3q}{2020/09/06}
+%         {Save \cs{@currpkg at reqd} so that we don't lose track of
+%          package substitutions.}
+%    The \cs{set at curr@file} line above might have replaced the file, so
+%    \cs{@currname} and \cs{@currext} may no longer hold the actual
+%    package being loaded, so in that case we need to update these two
+%    token lists (\cs{@curr at file} holds the file name after replacement,
+%    so we parse that).
+%
+%    The requested file is saved in \cs{@currpkg at reqd} to be used in
+%    \cs{InputIfFileExists} later:  if the updated \cs{@currname} and
+%    \cs{@currext} are used we lose track of the substitution, so
+%    \cs{CurrentFile} and \cs{CurrentFileUsed} will be (incorrectly)
+%    the same.
+%    \begin{macrocode}
+          \edef\@currpkg at reqd{\@currname.\@currext}%
+          \ifx\CurrentFile\CurrentFileUsed
+          \else
+            \filename at parse\@curr at file
+            \edef\@currname{\string at makeletter\filename at base}%
+            \edef\@currext{\string at makeletter\filename at ext}%
+          \fi
           \load at onefile@withoptions{#2}%
 %    \end{macrocode}
 %    Now just clean up and exit.
@@ -1761,11 +1799,10 @@
 %
 %    The kernel no longer uses \cs{@unprocessedoptions}
 %    \begin{macrocode}
-\let\@unprocessedoptions\@undefined  
+\let\@unprocessedoptions\@undefined
 %    \end{macrocode}
 % \end{macro}
-
-
+%
 % \begin{macro}{\@missing at onefilewithoptions}
 %    Now the action taken when a file is not found.
 %    \begin{macrocode}
@@ -1817,7 +1854,9 @@
 %    Now actually load the file (at this point we are certain it exists,
 %    but use \cs{InputIfFileExists} so that file hooks are executed):
 %    \begin{macrocode}
-    \InputIfFileExists{\@currname.\@currext}{}{}%
+    \InputIfFileExists{\@currpkg at reqd}{}%
+      {\@latex at error
+        {The \@cls at pkg\space\@currpkg at reqd\space failed to load.}\@ehd}%
 %-----------------------------------------
 %    \end{macrocode}
 %    In older versions of the code |\@unprocessedoptions| would
@@ -1878,7 +1917,7 @@
       \fi
     \fi}%
 %-----------------------------------------
-  \reserved at a}
+  \@ifl at aded\@currext\@currname{}{\reserved at a}}
 %    \end{macrocode}
 %  \end{macro}
 %    

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltdefns.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltdefns.dtx	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltdefns.dtx	2020-09-11 20:57:29 UTC (rev 56324)
@@ -32,7 +32,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltdefns.dtx}
-             [2020/08/21 v1.5m LaTeX Kernel (definition commands)]
+             [2020/09/06 v1.5n LaTeX Kernel (definition commands)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltdefns.dtx}
@@ -2194,7 +2194,57 @@
 %  \end{macro}
 %
 %
+% \begin{macro}{\string at makeletter}
+% \begin{macro}{\@string at makeletter}
+% \begin{macro}{\char at if@alph}
+%   Iterates through a string, turning each alphabetic character into
+%   a catcode-11 token (partly undoes a \cs{detokenize}).  Useful for
+%   \cs{ifx}-based string comparisons where \cs{detokenize}-ing the
+%   other string would break too much code.
 %
+%   \changes{v1.5n}{2020/09/06}
+%         {Macro added}
+%
+%   The macro uses \textsf{expl3}'s \cs{@expl at str@map at function@@NN} to
+%   iterate on the string (without losing spaces) and applies
+%   \cs{@string at makeletter} on each character.  The latter checks if
+%   character is between a--z or A--Z, and uses \cs{@alph} or \cs{@Alph}
+%   to get the corresponding catcode-11 token.  Other tokens are passed
+%   through unchanged.
+%    \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2020/10/01}{\string at makeletter}
+%<latexrelease>  {Add \string at makeletter}%
+%<*2ekernel|latexrelease>
+\def\string at makeletter#1{%
+  \@expl at str@map at function@@NN#1\@string at makeletter}
+\def\@string at makeletter#1{%
+  \char at if@alph{#1}%
+    {\@expl at char@generate@@nn{`#1}{11}}%
+    {#1}}
+\def\char at if@alph#1{%
+  \ifnum0\ifnum`#1<`A 1\fi\ifnum`#1>`z 1\fi
+      \if\ifnum`#1>`Z @\fi\ifnum`#1<`a @\fi01\fi>0
+    \expandafter\@secondoftwo
+  \else
+    \expandafter\@firstoftwo
+  \fi}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%
+%<latexrelease>\IncludeInRelease{0000/00/00}{\string at makeletter}
+%<latexrelease>  {Undefine \string at makeletter}%
+%<latexrelease>\let\string at makeletter\@undefined
+%<latexrelease>\let\@string at makeletter\@undefined
+%<latexrelease>\let\char at if@alph\@undefined
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
 % \begin{macro}{\makeatletter}
 % \begin{macro}{\makeatother}
 % \changes{v1.0n}{1994/05/10}{Added \cs{makeatletter} and
@@ -2207,7 +2257,6 @@
 % \end{macro}
 % \end{macro}
 %
-
 %
 % \section{Discretionary Hyphenation}
 % \begin{macro}{\-}

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltexpl.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltexpl.dtx	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltexpl.dtx	2020-09-11 20:57:29 UTC (rev 56324)
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltexpl.dtx}
-             [2020/08/21 v1.2e LaTeX Kernel (expl3-dependent code)]
+             [2020/09/06 v1.2f LaTeX Kernel (expl3-dependent code)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltexpl.dtx}
@@ -272,7 +272,7 @@
 %    \end{macrocode}
 %
 % \changes{v1.2e}{2020/08/19}
-%         {Add \cs{\@expl at cs@\meta{thing}@spec@@N}
+%         {Add \cs{@expl at cs@\meta{thing}@spec@@N}
 %          for \cs{ShowCommand} (gh/373)}
 %    \begin{macrocode}
 \cs_gset_eq:NN \@expl at cs@prefix at spec@@N \cs_prefix_spec:N
@@ -280,7 +280,16 @@
 \cs_gset_eq:NN \@expl at cs@replacement at spec@@N \cs_replacement_spec:N
 %    \end{macrocode}
 %
+% \changes{v1.2f}{2020/09/06}
+%         {Add \cs{@expl at str@map at function@@NN
+%          and \cs{@expl at char@generate@@nn}}
+%          for \cs{string at makeletter} (gh/386)}
 %    \begin{macrocode}
+\cs_gset_eq:NN \@expl at str@map at function@@NN \str_map_function:NN
+\cs_gset_eq:NN \@expl at char@generate@@nn \char_generate:nn
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 %<latexrelease>\EndIncludeInRelease
 %<latexrelease>\IncludeInRelease{0000/00/00}{expl3~2020-10-01}%
 %<latexrelease>        {expl3~macros~added~for~the~2020-10-01~release}%
@@ -289,6 +298,7 @@
 %<latexrelease>\cs_undefine:N \@expl at cs@prefix at spec@@N
 %<latexrelease>\cs_undefine:N \@expl at cs@argument at spec@@N
 %<latexrelease>\cs_undefine:N \@expl at cs@replacement at spec@@N
+%<latexrelease>\cs_undefine:N \@expl at str@map at function@@NN
 %<latexrelease>\EndIncludeInRelease
 %</2ekernel|latexrelease>
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltfilehook.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltfilehook.dtx	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltfilehook.dtx	2020-09-11 20:57:29 UTC (rev 56324)
@@ -28,7 +28,7 @@
 %
 % \iffalse
 %
-%%% From File: ltshipout.dtx
+%%% From File: ltfilehook.dtx
 %
 %    \begin{macrocode}
 \providecommand\ltfilehookversion{v1.0a}
@@ -1357,7 +1357,7 @@
 %    \end{macrocode}
 %    
 %    \begin{macrocode}
-\cs_new_eq:NN \@expl@@@filehook at file@push@@ 
+\cs_new_eq:NN \@expl@@@filehook at file@push@@
                \__filehook_file_push:
 %    \end{macrocode}
 %    
@@ -1434,7 +1434,7 @@
 %   If there was a file replacement, show that as well:
 %    \begin{macrocode}
         \str_if_eq:NNF \CurrentFileUsed \CurrentFile
-          { ~ ( \CurrentFile \space requested ) }
+          { ~ ( \CurrentFile \c_space_tl requested ) }
         \iow_newline:
       }
     \str_if_eq:nnT {#1} {STOP} { \int_gdecr:N \g_@@_nesting_level_int }
@@ -1485,7 +1485,7 @@
 %    Here is the package file we point to:
 %    \begin{macrocode}
 %<*atveryend-ltx>
-\ProvidesPackage{atveryend}
+\ProvidesPackage{atveryend-ltx}
    [2020/08/19 v1.0a
      Emulation of the original atvery package^^Jwith kernel methods]
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltfiles.dtx	2020-09-11 20:57:29 UTC (rev 56324)
@@ -461,7 +461,7 @@
 %    \begin{macrocode}
 \edef \@kernel at after@begindocument at before {%
   \let\expandafter\noexpand\csname
-       g__hook_env/document/begin_code_tl\endcsname
+       __hook env/document/begin\endcsname
   \noexpand\@empty}
 %    \end{macrocode}
 %

Modified: trunk/Master/texmf-dist/source/latex-dev/base/lthooks.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/lthooks.dtx	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/source/latex-dev/base/lthooks.dtx	2020-09-11 20:57:29 UTC (rev 56324)
@@ -32,7 +32,7 @@
 %
 %    \begin{macrocode}
 \def\lthooksversion{v1.0a}
-\def\lthooksdate{2020/08/31}
+\def\lthooksdate{2020/09/10}
 %    \end{macrocode}
 %
 %<*driver>
@@ -351,6 +351,21 @@
 % \meta{label} throughout the sub-packages in order to avoid
 % that the labels change if you internally reorganize your code.
 %
+% Except for \cs{UseHook}, \cs{UseOneTimeHook}, \cs{IfHookEmptyTF}, and
+% \cs{IfHookExistsTF} (and their \pkg{expl3} interfaces \cs{hook_use:n},
+% \cs{hook_use_once:n}, \cs{hook_if_empty:nTF}, and
+% \cs{hook_if_exist:nTF}), all \meta{hook}
+% and \meta{label} arguments are processed in the same way: first,
+% spaces are trimmed around the argument, then it is fully expanded
+% until only character tokens remain.  If the full expansion of the
+% \meta{hook} or \meta{label} contains a non-expandable non-character
+% token, a low-level \TeX{} error is raised (namely, the \meta{hook} is
+% expanded using \TeX's \cs{csname}\ldots\cs{endcsname}, as such,
+% Unicode characters are allowed in \meta{hook} and \meta{label}
+% arguments).  The arguments of \cs{UseHook} and \cs{UseOneTimeHook} are
+% processed much in the same way except that spaces are not trimmed
+% around the argument, for better performance.
+%
 % It is not enforced, but highly recommended that the hooks defined by
 % a package, and the \meta{labels} used to add code to other hooks
 % contain the package name to easily identify the source of the code
@@ -599,6 +614,10 @@
 %   to adding and removing code from it, so this test should be used
 %   sparingly.
 %
+%   Generic hooks are declared at the time code is added to them, so the
+%   result of \cs{hook_if_exist:n} will change once code is added to
+%   said hook (unless the hook was previously declared).
+%
 %    The \meta{hook} \emph{cannot} be specified using the dot-syntax.
 %    A leading |.| is treated literally.
 % \end{function}
@@ -611,7 +630,7 @@
 %    rule it is helpful to get some information about the code
 %    associated with a hook, its current order and the existing rules.
 %
-% \begin{function}{\ShowHook}
+% \begin{function}{\ShowHook,\LogHook}
 %   \begin{syntax}
 %     \cs{ShowHook} \Arg{hook}
 %   \end{syntax}
@@ -627,6 +646,10 @@
 %      any code executed on the next invocation only.
 %   \end{itemize}
 %
+%   \cs{LogHook} prints the information to the |.log| file, and
+%   \cs{ShowHook} prints them to the terminal/command window and starts
+%   \TeX's prompt (only if \cs{errorstopmode}) to wait for user action.
+%
 %    The \meta{hook} can be specified using the dot-syntax to denote
 %    the current package name. See section~\ref{sec:default-label}.
 % \end{function}
@@ -796,8 +819,6 @@
 %   branches to either \meta{true code} or \meta{false code} depending
 %   on the result.
 %
-%  \fmi{what are the results for generic hooks that do not need to be declared?}
-%
 %   The existence of a hook usually doesn't mean much from the viewpoint
 %   of code that tries to add/remove code from that hook, since package
 %   loading order may vary, thus the creation of hooks is asynchronous
@@ -804,11 +825,38 @@
 %   to adding and removing code from it, so this test should be used
 %   sparingly.
 %
+%   Generic hooks are declared at the time code is added to them, so the
+%   result of \cs{hook_if_exist:n} will change once code is added to
+%   said hook (unless the hook was previously declared).
+%
 %    The \meta{hook} \emph{cannot} be specified using the dot-syntax.
 %    A leading |.| is treated literally.
 % \end{function}
 %
+% \begin{function}{\hook_show:n,\hook_log:n}
+%   \begin{syntax}
+%     \cs{hook_show:n} \Arg{hook}
+%   \end{syntax}
+%   Displays information about the \meta{hook} such as
+%   \begin{itemize}
+%   \item
+%      the code chunks (and their labels) added to it,
+%   \item
+%      any rules set up to order them,
+%   \item
+%      the computed order in which the chunks are executed,
+%   \item
+%      any code executed on the next invocation only.
+%   \end{itemize}
 %
+%   \cs{hook_log:n} prints the information to the |.log| file, and
+%   \cs{hook_show:n} prints them to the terminal/command window and starts
+%   \TeX's prompt (only if \cs{errorstopmode}) to wait for user action.
+%
+%    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_debug_on:,\hook_debug_off:}
 %   \begin{syntax}
 %     \cs{hook_debug_on:}
@@ -1586,6 +1634,20 @@
 %    \end{macrocode}
 % \end{macro}
 %
+%  \begin{macro}{\g_@@_execute_immediately_prop}
+%    List of hooks that from no on should not longer receive code.
+%    \begin{macrocode}
+\prop_new:N \g_@@_execute_immediately_prop
+%    \end{macrocode}
+%  \end{macro}
+%
+%  \begin{macro}{\g_@@_used_prop}
+%    All hooks that receive code (for use in debugging display).
+%    \begin{macrocode}
+\prop_new:N \g_@@_used_prop
+%    \end{macrocode}
+%  \end{macro}
+%
 % \begin{macro}{\g_@@_hook_curr_name_tl,\g_@@_name_stack_seq}
 %   Default label used for hook commands, and a stack to keep track of
 %   packages within packages.
@@ -1602,10 +1664,12 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\tl_gremove_once:Nx}
+% \begin{macro}{\tl_gremove_once:Nx,\tl_show:x,\tl_log:x}
 %   Some variants of \pkg{expl3} functions. \fmi{should be moved to expl3}
 %    \begin{macrocode}
 \cs_generate_variant:Nn \tl_gremove_once:Nn { Nx }
+\cs_generate_variant:Nn \tl_show:n { x }
+\cs_generate_variant:Nn \tl_log:n { x }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1619,7 +1683,7 @@
 %
 % \subsection{Providing new hooks}
 %
-% \begin{macro}{\g_@@_..._code_prop,\g_@@_..._code_tl,\g_@@_..._code_next_tl}
+% \begin{macro}{\g_@@_..._code_prop,\@@~...,\@@_next~...}
 %
 %    Hooks have a \meta{name} and for each hook we have to provide a number of
 %    data structures. These are
@@ -1635,10 +1699,14 @@
 %    (reverse) sorted to ensure that two labels always point to the same
 %    token list.  For global rules, the \meta{name} is |??|.
 %
-%    \item[\cs{g_@@_\meta{name}_code_tl}] The code that is actually executed
+%    \item[\cs{@@~\meta{name}}] The code that is actually executed
 %    when the hook is called in the document is stored in this token
 %    list. It is constructed from the code chunks applying the
 %    information.
+%    This token list is named like that so that in case of an error
+%    inside the hook, the reported token list in the error is shorter,
+%    and to make it simpler to normalize hook names in
+%    \cs{@@_make_name:n}.
 %
 %    \item[\cs{g_@@_\meta{name}_reversed_tl}] Some hooks are
 %    \enquote{reversed}.  This token list stores a |-| for such hook
@@ -1646,14 +1714,15 @@
 %    $\meta{reversed}1$ is $+1$ for normal hooks and $-1$ for reversed
 %    ones.
 %
-%    \item[\cs{g_@@_\meta{name}_code_next_tl}] Finally there is extra code
+%    \item[\cs{@@_next~\meta{name}}] Finally there is extra code
 %    (normally empty) that is used on the next invocation of the hook
 %    (and then deleted). This can be used to define some special
 %    behavior for a single occasion from within the document.  This token
-%    list is called |code_next| rather than |next_code| because otherwise
-%    a hook called \meta{name}|_next| would have its code-token list
-%    named \cs[no-index]{g_@@_\meta{name}_code_next_tl}, which would
-%    clash with the next code-token list of a hook called \meta{name}.
+%    list follows the same naming scheme than the main \cs{@@~\meta{name}}
+%    token list.  It is called \cs{@@_next~\meta{name}} rather than
+%    \cs{@@~next_\meta{name}} because otherwise a hook whose name is
+%    |next_|\meta{name} would clash with the next code-token list of the
+%    hook called \meta{name}.
 %
 %    \end{description}
 %  \end{macro}
@@ -1667,42 +1736,41 @@
 %    \hook{begindocument}.
 %    \begin{macrocode}
 \cs_new_protected:Npn \hook_new:n #1
+  { \@@_normalize_hook_args:Nn \@@_new:n {#1} }
+\cs_new_protected:Npn \@@_new:n #1
   {
-    \exp_args:Nx \@@_new:n
-      { \@@_parse_label_default:nn {#1} { top-level } }
-  }
-\cs_new_protected:Npn \@@_new:n #1 {
 %    \end{macrocode}
 %    We check for one of the internal data structures and if it
 %    already exists we complain.
 %    \begin{macrocode}
-  \hook_if_exist:nTF {#1}
-       { \msg_error:nnn { hooks } { exists } {#1} }
+    \hook_if_exist:nTF {#1}
+      { \msg_error:nnn { hooks } { exists } {#1} }
 %    \end{macrocode}
 %    Otherwise we add the hook name to the list of all hooks and
 %    allocate the necessary data structures for the new hook.
 %    \begin{macrocode}
-     { \seq_gput_right:Nn \g_@@_all_seq {#1}
+      {
+        \seq_gput_right:Nn \g_@@_all_seq {#1}
 %    \end{macrocode}
 %    This is only used by the actual code of the current hook, so
 %    declare it normally:
 %    \begin{macrocode}
-       \tl_new:c { g_@@_#1_code_tl }
+        \tl_new:c { @@~#1 }
 %    \end{macrocode}
 %    Now ensure that the base data structure for the hook exists:
 %    \begin{macrocode}
-       \@@_declare:n {#1}
+        \@@_declare:n {#1}
 %    \end{macrocode}
 %    The \cs{g_@@_\meta{hook}_labels_clist} holds the sorted list of
 %    labels (once it got sorted). This is used only for debugging.
 %    \begin{macrocode}
-       \clist_new:c {g_@@_#1_labels_clist}
+        \clist_new:c {g_@@_#1_labels_clist}
 %    \end{macrocode}
 %    Some hooks should reverse the default order of code chunks. To
 %    signal this we have a token list which is empty for normal hooks
 %    and contains a \verb=-= for reversed hooks.
 %    \begin{macrocode}
-       \tl_new:c { g_@@_#1_reversed_tl }
+        \tl_new:c { g_@@_#1_reversed_tl }
 %    \end{macrocode}
 %    The above is all in L3 convention, but we also provide an
 %    interface to legacy \LaTeXe{} hooks of the form \cs{@...hook},
@@ -1717,9 +1785,9 @@
 %    \end{quote}
 %
 %    \begin{macrocode}
-       \@@_include_legacy_code_chunk:n {#1}
+        \@@_include_legacy_code_chunk:n {#1}
      }
-}
+  }
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -1737,7 +1805,7 @@
     \@@_if_exist:nF {#1}
       {
         \prop_new:c { g_@@_#1_code_prop }
-        \tl_new:c { g_@@_#1_code_next_tl }
+        \tl_new:c { @@_next~#1 }
       }
   }
 %    \end{macrocode}
@@ -1745,20 +1813,23 @@
 %
 %
 %
-%  \begin{macro}{\hook_new_reversed:n}
+%  \begin{macro}{\hook_new_reversed:n,\@@_new_reversed:n}
 %
 %    Declare a new hook. The default ordering of code chunks is
 %    reversed, signaled by setting the token list to a minus sign.
 %    \begin{macrocode}
-\cs_new_protected:Npn \hook_new_reversed:n #1 {
-  \hook_new:n {#1}
+\cs_new_protected:Npn \hook_new_reversed:n #1
+  { \@@_normalize_hook_args:Nn \@@_new_reversed:n {#1} }
+\cs_new_protected:Npn \@@_new_reversed:n #1
+  {
+    \@@_new:n {#1}
 %    \end{macrocode}
 %    If the hook already exists the above will generate an error
 %    message, so the next line should be executed (but it is --- too
 %    bad).
 %    \begin{macrocode}
-  \tl_gset:cn { g_@@_#1_reversed_tl } { - }
-}
+    \tl_gset:cn { g_@@_#1_reversed_tl } { - }
+  }
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -1765,9 +1836,8 @@
 %  \begin{macro}{\hook_new_pair:nn}
 %    A shorthand for declaring a normal and a (matching) reversed hook in one go.
 %    \begin{macrocode}
-\cs_new_protected:Npn \hook_new_pair:nn #1#2 {
-  \hook_new:n {#1}  \hook_new_reversed:n {#2}
-}
+\cs_new_protected:Npn \hook_new_pair:nn #1#2
+  { \hook_new:n {#1} \hook_new_reversed:n {#2} }
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -1823,19 +1893,24 @@
 %
 % \subsection{Parsing a label}
 %
-% \begin{macro}[EXP]{\@@_parse_label_default:nn,\@@_parse_label_default:Vn}
+% \begin{macro}[EXP]{\@@_parse_label_default:n}
 %   This macro checks if a label was given (not \cs{c_novalue_tl}), and
 %   if so, tries to parse the label looking for a leading \verb|.| to
 %   replace for \cs{@currname}.  Otherwise \cs{@@_currname_or_default:n}
 %   is used to pick \cs{@currname} or the fallback value.
+%
+%   The default |top-level| is hard-coded here.  It once was an
+%   argument, but it's no longer needed. \pho{can't remember why}
 %    \begin{macrocode}
-\cs_new:Npn \@@_parse_label_default:nn #1 #2
+\cs_new:Npn \@@_parse_label_default:n #1
   {
     \tl_if_novalue:nTF {#1}
-      { \@@_currname_or_default:n {#2} }
-      { \tl_trim_spaces_apply:nN {#1} \@@_parse_dot_label:nn {#2} }
+      { \@@_currname_or_default:n { top-level } }
+      {
+        \tl_trim_spaces_apply:nN {#1}
+          \@@_parse_dot_label:nn { top-level }
+      }
   }
-\cs_generate_variant:Nn \@@_parse_label_default:nn { V }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -1862,7 +1937,7 @@
       }
       {
         \str_if_eq:nnTF {#1} { . }
-          { \@@_currname_or_default:n {#1} }
+          { \@@_currname_or_default:n {#2} }
           { \@@_parse_dot_label:nw {#2} #1 ./ \s_@@_mark }
       }
   }
@@ -1872,13 +1947,13 @@
       { \@@_parse_dot_label_aux:nw {#1} #3 \s_@@_mark }
       {
         \tl_if_empty:nTF {#3}
-          {#2}
+          { \@@_make_name:n {#2} }
           { \@@_parse_dot_label_cleanup:w #2 ./ #3 \s_@@_mark }
       }
   }
 \cs_new:Npn \@@_parse_dot_label_cleanup:w #1 ./ \s_@@_mark {#1}
 \cs_new:Npn \@@_parse_dot_label_aux:nw #1 #2 ./ \s_@@_mark
-  { \@@_currname_or_default:n {#1} / #2 }
+  { \@@_currname_or_default:n {#1} / \@@_make_name:n {#2} }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -1893,7 +1968,7 @@
     \tl_if_empty:NTF \g_@@_hook_curr_name_tl
       {
         \tl_if_empty:NTF \@currname
-          {#1}
+          { \@@_make_name:n {#1} }
           { \@currname }
       }
       { \g_@@_hook_curr_name_tl }
@@ -1901,7 +1976,73 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}[EXP]{\@@_make_name:n,\@@_make_name:w}
+%   Provides a standard sanitisation of a hook's name.
+%   It uses \cs{cs:w} to build a control sequence out of the hook name,
+%   then uses \cs{cs_to_str:N} to get the string representation of that,
+%   without the escape character.  \cs{cs:w}-based expansion is used
+%   instead of |e|-based because Unicode characters don't behave well
+%   inside \cs{expanded}.  The macro adds the \cs{@@~} prefix to the
+%   hook name to reuse the hook's code token list to build the csname
+%   and avoid leaving \enquote{public} control sequences defined
+%   (as~\cs{relax}) in TeX's memory.
+%    \begin{macrocode}
+\cs_new:Npn \@@_make_name:n #1
+  {
+    \exp_after:wN \exp_after:wN \exp_after:wN \@@_make_name:w
+    \exp_after:wN \token_to_str:N \cs:w @@~ #1 \cs_end:
+  }
+\exp_last_unbraced:NNNNo
+\cs_new:Npn \@@_make_name:w #1 \tl_to_str:n { @@~ } { }
+%    \end{macrocode}
+% \end{macro}
 %
+% \begin{macro}{\@@_normalize_hook_args:Nn}
+% \begin{macro}{\@@_normalize_hook_args:Nnn}
+% \begin{macro}{\@@_normalize_hook_rule_args:Nnnnn}
+% \begin{macro}{\@@_normalize_hook_args_aux:Nn}
+%   Standard route for normalising hook and label arguments.  The main
+%   macro does the entire operation within a group so that csnames made
+%   by \cs{@@_make_name:n} are wiped off before continuing.  This means
+%   that this function cannot be used for \cs{hook_use:n}!
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_normalize_hook_args_aux:Nn #1 #2
+  {
+    \group_begin:
+    \use:e
+      {
+        \group_end:
+        \exp_not:N #1 #2
+      }
+  }
+\cs_new_protected:Npn \@@_normalize_hook_args:Nn #1 #2
+  {
+    \@@_normalize_hook_args_aux:Nn #1
+      { { \@@_parse_label_default:n {#2} } }
+  }
+\cs_new_protected:Npn \@@_normalize_hook_args:Nnn #1 #2 #3
+  {
+    \@@_normalize_hook_args_aux:Nn #1
+      {
+        { \@@_parse_label_default:n {#2} }
+        { \@@_parse_label_default:n {#3} }
+      }
+  }
+\cs_new_protected:Npn \@@_normalize_hook_rule_args:Nnnnn #1 #2 #3 #4 #5
+  {
+    \@@_normalize_hook_args_aux:Nn #1
+      {
+        { \@@_parse_label_default:n {#2} }
+        { \@@_parse_label_default:n {#3} }
+        { \tl_trim_spaces:n {#4} }
+        { \@@_parse_label_default:n {#5} }
+      }
+  }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
 %
 % \begin{macro}{\hook_gput_code:nnn}
@@ -1912,15 +2053,17 @@
 %    with \meta{label}.
 %    \begin{macrocode}
 \cs_new_protected:Npn \hook_gput_code:nnn #1 #2
-  {
-    \exp_args:Nxx \@@_gput_code:nnn
-      { \@@_parse_label_default:nn {#1} { top-level } }
-      { \@@_parse_label_default:nn {#2} { top-level } }
-  }
+  { \@@_normalize_hook_args:Nnn \@@_gput_code:nnn {#1} {#2} }
 \cs_new_protected:Npn \@@_gput_code:nnn #1 #2 #3
   {
 %    \end{macrocode}
-%    First check if the current \meta{hook}/\meta{label} pair was marked
+%    First check if the hook was used as a one-time hook:
+%    \begin{macrocode}
+    \prop_if_in:NnTF \g_@@_execute_immediately_prop {#1}
+      {#3}
+      {
+%    \end{macrocode}
+%    Then check if the current \meta{hook}/\meta{label} pair was marked
 %    for removal, in which case \cs{@@_unmark_removal:nn} is used to
 %    remove that mark (once).  This may happen when a package removes
 %    code from another package which was not yet loaded:  the removal
@@ -1927,28 +2070,28 @@
 %    order is stored, and at this stage it is executed by not adding to
 %    the hook.
 %    \begin{macrocode}
-    \@@_if_marked_removal:nnTF {#1} {#2}
-      { \@@_unmark_removal:nn {#1} {#2} }
-      {
+        \@@_if_marked_removal:nnTF {#1} {#2}
+          { \@@_unmark_removal:nn {#1} {#2} }
+          {
 %    \end{macrocode}
 %    If no removal is queued, we are free to add.  Start by checking if
 %    the hook exists.
 %    \begin{macrocode}
-        \hook_if_exist:nTF {#1}
+            \hook_if_exist:nTF {#1}
 %    \end{macrocode}
 %    If so we simply add (or append) the new code to the property list
 %    holding different chunks for the hook. At \verb=\begin{document}=
 %    this is then sorted into a token list for fast execution.
 %    \begin{macrocode}
-          {
-            \@@_hook_gput_code_do:nnn {#1} {#2} {#3}
+              {
+                \@@_hook_gput_code_do:nnn {#1} {#2} {#3}
 %    \end{macrocode}
 %    However, if there is an update within the document we need to alter
 %    this execution code which is done by
 %    \cs{@@_update_hook_code:n}. In the preamble this does nothing.
 %    \begin{macrocode}
-            \@@_update_hook_code:n {#1}
-          }
+                \@@_update_hook_code:n {#1}
+              }
 %    \end{macrocode}
 %
 %    If the hook does not exist, however, before giving up try to
@@ -1955,7 +2098,8 @@
 %    declare it as a generic hook, if its name matches one of the valid
 %    patterns.
 %    \begin{macrocode}
-          { \@@_try_declaring_generic_hook:nnn {#1} {#2} {#3} }
+              { \@@_try_declaring_generic_hook:nnn {#1} {#2} {#3} }
+          }
       }
   }
 \cs_generate_variant:Nn \@@_gput_code:nnn { nxv }
@@ -2187,11 +2331,7 @@
 %    for \meta{hook} stored under \meta{label} is removed.
 %    \begin{macrocode}
 \cs_new_protected:Npn \hook_gremove_code:nn #1 #2
-  {
-    \exp_args:Nxx \@@_gremove_code:nn
-      { \@@_parse_label_default:nn {#1} { top-level } }
-      { \@@_parse_label_default:nn {#2} { top-level } }
-  }
+  { \@@_normalize_hook_args:Nnn \@@_gremove_code:nn {#1} {#2} }
 \cs_new_protected:Npn \@@_gremove_code:nn #1 #2
   {
 %    \end{macrocode}
@@ -2250,6 +2390,10 @@
 %   \cs{tl_gremove_once:Nx} is fairly efficient even for longer token
 %   lists, so we use a single global token list, rather than one for
 %   each hook.
+%
+%   A hand-crafted token list is used here because property lists don't
+%   hold repeated items, so multiple usages of \cs{@@_mark_removal:nn}
+%   would be cancelled by a single \cs{@@_unmark_removal:nn}.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_mark_removal:nn #1 #2
   {
@@ -2300,7 +2444,7 @@
 %
 % \begin{macro}{
 %     \g_@@_??_code_prop,
-%     \g_@@_??_code_tl,
+%     \@@~??,
 %     \g_@@_??_reversed_tl,
 %   }
 %
@@ -2315,11 +2459,11 @@
 %    lot things should be fast, so this is not done with \texttt{c}
 %    expansion in the code later on.
 %
-%    \cs{g_@@_??_code_tl} isn't used, but it has to be defined to trick
+%    \cs{@@~??} isn't used, but it has to be defined to trick
 %    the code into thinking that \verb=??= is actually a hook.
 %    \begin{macrocode}
 \prop_new:c {g_@@_??_code_prop}
-\prop_new:c {g_@@_??_code_tl}
+\prop_new:c {@@~??}
 %    \end{macrocode}
 %
 %    Default rules are always given in normal ordering (never in
@@ -2347,14 +2491,8 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \hook_gset_rule:nnnn #1#2#3#4
   {
-    \use:x
-      {
-        \@@_gset_rule:nnnn
-          { \@@_parse_label_default:nn {#1} { top-level } }
-          { \@@_parse_label_default:nn {#2} { top-level } }
-          {#3}
-          { \@@_parse_label_default:nn {#4} { top-level } }
-      }
+    \@@_normalize_hook_rule_args:Nnnnn \@@_gset_rule:nnnn
+      {#1} {#2} {#3} {#4}
   }
 %    \end{macrocode}
 %    
@@ -2544,7 +2682,7 @@
      { \iow_term:x{^^JAll~ initialized~ (non-empty)~ hooks:}
        \prop_map_inline:Nn \g_@@_used_prop
            { \iow_term:x{^^J~ ##1~ ->~
-               \exp_not:v {g_@@_##1_code_tl}~ }
+               \exp_not:v {@@~##1}~ }
            }
      }
 %    \end{macrocode}
@@ -2566,9 +2704,11 @@
 %    and at \verb=\begin{document}= this is done for all hooks and
 %    afterwards only if the hook code changes.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_initialize_hook_code:n #1 {
-  \@@_debug:n{ \iow_term:x{^^JUpdate~ code~ for~ hook~
-                                  '#1' \on at line :^^J} }
+\cs_new_protected:Npn \@@_initialize_hook_code:n #1
+  {
+    \debug_suspend:
+    \@@_debug:n{ \iow_term:x{^^JUpdate~ code~ for~ hook~
+                                    '#1' \on at line :^^J} }
 %    \end{macrocode}
 %    This does the sorting and the updates.
 %    First thing we do is to check if a legacy hook macro exists and
@@ -2576,23 +2716,23 @@
 %    might make the hook non-empty so we have to do this before
 %    the then following test.
 %    \begin{macrocode}
-  \@@_include_legacy_code_chunk:n {#1}  
+    \@@_include_legacy_code_chunk:n {#1}
 %    \end{macrocode}
 %    If there aren't any code
 %    chunks for the current hook, there is no point in even starting
 %    the sorting routine so we make a quick test for that and in that
-%    case just update \cs{g_@@_\meta{hook}_code_tl} to hold the next
+%    case just update \cs{@@~\meta{hook}} to hold the next
 %    code. If there are code chunks we call
 %    \cs{@@_initialize_single:NNNn} and pass to it ready made csnames
 %    as they are needed several times inside. This way we save a bit
 %    on processing time if we do that up front.
 %    \begin{macrocode}
-  \hook_if_exist:nT {#1}
-    {
-      \prop_if_empty:cTF {g_@@_#1_code_prop}
-        { \tl_gset:co {g_@@_#1_code_tl}
-                      {\cs:w g_@@_#1_code_next_tl \cs_end: } }
-        {
+    \hook_if_exist:nT {#1}
+      {
+        \prop_if_empty:cTF {g_@@_#1_code_prop}
+          { \tl_gset:co { @@~#1 }
+                        { \cs:w @@_next~#1 \cs_end: } }
+          {
 %    \end{macrocode}
 %    By default the algorithm sorts the code chunks and then saves the
 %    result in a token list for fast execution by adding the code one
@@ -2601,11 +2741,11 @@
 %    the opposite order into the token list. So all we have to do
 %    in preparation is to change two definitions used later on.
 %    \begin{macrocode}
-          \@@_if_reversed:nTF {#1}
-            { \cs_set_eq:NN \@@_tl_gput:NV    \tl_gput_left:NV
-              \cs_set_eq:NN \@@_clist_gput:NV \clist_gput_left:NV  }
-            { \cs_set_eq:NN \@@_tl_gput:NV    \tl_gput_right:NV
-              \cs_set_eq:NN \@@_clist_gput:NV \clist_gput_right:NV }
+            \@@_if_reversed:nTF {#1}
+              { \cs_set_eq:NN \@@_tl_gput:NV    \tl_gput_left:NV
+                \cs_set_eq:NN \@@_clist_gput:NV \clist_gput_left:NV  }
+              { \cs_set_eq:NN \@@_tl_gput:NV    \tl_gput_right:NV
+                \cs_set_eq:NN \@@_clist_gput:NV \clist_gput_right:NV }
 %    \end{macrocode}
 %
 %    When sorting, some relations (namely \verb|voids|) need to
@@ -2613,10 +2753,10 @@
 %    shouldn't appear in the sorted hook token list, so we temporarily
 %    save the old code property list so that it can be restored later.
 %    \begin{macrocode}
-          \prop_set_eq:Nc \l_@@_work_prop { g_@@_#1_code_prop }
-          \@@_initialize_single:cccn
-            { g_@@_#1_code_tl } { g_@@_#1_code_next_tl }
-            { g_@@_#1_labels_clist } {#1}
+            \prop_set_eq:Nc \l_@@_work_prop { g_@@_#1_code_prop }
+            \@@_initialize_single:cccn
+              { @@~#1 } { @@_next~#1 }
+              { g_@@_#1_labels_clist } {#1}
 %    \end{macrocode}
 %    For debug display we want to keep track of those hooks that
 %    actually got code added to them, so we record that in plist. We
@@ -2624,24 +2764,16 @@
 %    i.e., we are only interested in storing the keys and the value is
 %    arbitrary.
 %    \begin{macrocode}
-          \@@_debug:n{ \exp_args:NNx \prop_gput:Nnn
-                                     \g_@@_used_prop {#1}{} }
-        }
-    }
-}
+            \@@_debug:n{ \exp_args:NNx \prop_gput:Nnn
+                                       \g_@@_used_prop {#1}{} }
+          }
+      }
+    \debug_resume:
+  }
 %    \end{macrocode}
 %  \end{macro}
 %
 %
-%  \begin{macro}{\g_@@_used_prop}
-%    All hooks that receive code (for use in debugging display).
-%    \begin{macrocode}
-\prop_new:N\g_@@_used_prop
-%    \end{macrocode}
-%  \end{macro}
-%
-%
-%
 % \begin{macro}[EXP]{\@@_tl_csname:n,\@@_seq_csname:n}
 %   It is faster to pass a single token and expand it when necessary
 %   than to pass a bunch of character tokens around.
@@ -2653,8 +2785,6 @@
 % \end{macro}
 %
 %
-%
-%
 %  \begin{macro}{\l_@@_labels_seq,\l_@@_labels_int,\l_@@_front_tl,
 %      \l_@@_rear_tl,\l_@@_label_0_tl}
 %
@@ -2712,21 +2842,18 @@
 %    the moment: a label can't be equal to the number 0!  \fmi{Needs
 %    checking for, just in case}
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_initialize_single:NNNn #1#2#3#4 {
+\cs_new_protected:Npn \@@_initialize_single:NNNn #1#2#3#4
+  {
 %    \end{macrocode}
-%    
-%    \begin{macrocode}
-  \debug_suspend:
-%    \end{macrocode}
 %    Step T1: Initialize the data structure \ldots
 %    \begin{macrocode}
-  \seq_clear:N \l_@@_labels_seq
-  \int_zero:N  \l_@@_labels_int
+    \seq_clear:N \l_@@_labels_seq
+    \int_zero:N  \l_@@_labels_int
 %    \end{macrocode}
 %
 %    Store the name of the hook:
 %    \begin{macrocode}
-  \tl_set:Nn \l_@@_cur_hook_tl {#4}
+    \tl_set:Nn \l_@@_cur_hook_tl {#4}
 %    \end{macrocode}
 %    
 %    We loop over the property list holding the code and record all
@@ -2736,13 +2863,13 @@
 %    to ensure that labels named |front|, |rear|, |labels|, or |return|
 %    don't interact with our code.
 %    \begin{macrocode}
-  \prop_map_inline:Nn \l_@@_work_prop
-     {
-       \int_incr:N \l_@@_labels_int
-       \seq_put_right:Nn \l_@@_labels_seq {##1}
-       \tl_set:cn { \@@_tl_csname:n {##1} }{0}
-       \seq_clear_new:c { \@@_seq_csname:n {##1} }
-     }
+    \prop_map_inline:Nn \l_@@_work_prop
+       {
+         \int_incr:N \l_@@_labels_int
+         \seq_put_right:Nn \l_@@_labels_seq {##1}
+         \tl_set:cn { \@@_tl_csname:n {##1} }{0}
+         \seq_clear_new:c { \@@_seq_csname:n {##1} }
+       }
 %    \end{macrocode}
 %    Steps T2 and T3: Sort the relevant rules into the data structure\ldots
 %    
@@ -2758,30 +2885,30 @@
 %    \cs{@@_apply_label_pair:nnn}, which takes the properly-ordered pair
 %    of labels as argument.
 %    \begin{macrocode}
-  \prop_map_inline:Nn \l_@@_work_prop
-    {
-      \prop_map_inline:Nn \l_@@_work_prop
-        {
-          \@@_if_label_case:nnnnn {##1} {####1}
-            { \prop_map_break: }
-            { \@@_apply_label_pair:nnn {##1} {####1} }
-            { \@@_apply_label_pair:nnn {####1} {##1} }
-                {#4}
-        }
-    }
+    \prop_map_inline:Nn \l_@@_work_prop
+      {
+        \prop_map_inline:Nn \l_@@_work_prop
+          {
+            \@@_if_label_case:nnnnn {##1} {####1}
+              { \prop_map_break: }
+              { \@@_apply_label_pair:nnn {##1} {####1} }
+              { \@@_apply_label_pair:nnn {####1} {##1} }
+                  {#4}
+          }
+      }
 %    \end{macrocode}
 %    Take a breath and take a look at the data structures that have
 %    been set up:
 %    \begin{macrocode}
-  \@@_debug:n { \@@_debug_label_data:N \l_@@_work_prop }
+    \@@_debug:n { \@@_debug_label_data:N \l_@@_work_prop }
 %    \end{macrocode}
 %    
 %
 %    Step T4:
 %    \begin{macrocode}
-  \tl_set:Nn \l_@@_rear_tl { 0 }
-  \tl_set:cn { \@@_tl_csname:n { 0 } } { 0 }
-  \seq_map_inline:Nn \l_@@_labels_seq
+    \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
             {
@@ -2789,29 +2916,29 @@
               \tl_set:Nn \l_@@_rear_tl {##1}
             }
       }
-  \tl_set_eq:Nc \l_@@_front_tl { \@@_tl_csname:n { 0 } }
+    \tl_set_eq:Nc \l_@@_front_tl { \@@_tl_csname:n { 0 } }
 %    \end{macrocode}
 %    
 %    \begin{macrocode}
-  \tl_gclear:N #1
-  \clist_gclear:N #3
+    \tl_gclear:N #1
+    \clist_gclear:N #3
 %    \end{macrocode}
 %
 %    The whole loop combines steps T5--T7:
 %    \begin{macrocode}
-  \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 } }
+      {
 %    \end{macrocode}
 %    This part is step T5:
 %    \begin{macrocode}
-         \int_decr:N \l_@@_labels_int
-         \prop_get:NVN \l_@@_work_prop \l_@@_front_tl \l_@@_return_tl
-         \@@_tl_gput:NV #1 \l_@@_return_tl
+        \int_decr:N \l_@@_labels_int
+        \prop_get:NVN \l_@@_work_prop \l_@@_front_tl \l_@@_return_tl
+        \@@_tl_gput:NV #1 \l_@@_return_tl
 %    \end{macrocode}
 %    
 %    \begin{macrocode}
-         \@@_clist_gput:NV #3 \l_@@_front_tl
-         \@@_debug:n{ \iow_term:x{Handled~ code~ for~ \l_@@_front_tl} }
+        \@@_clist_gput:NV #3 \l_@@_front_tl
+        \@@_debug:n{ \iow_term:x{Handled~ code~ for~ \l_@@_front_tl} }
 %    \end{macrocode}
 %
 %    This is step T6 except that we don't use a pointer $P$ to move
@@ -2818,24 +2945,24 @@
 %    through the successors, but instead use \verb=##1= of the mapping
 %    function.
 %    \begin{macrocode}
-         \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_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}
-                   }
-             }
+        \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_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}
+                }
+          }
 %    \end{macrocode}
 %    and step T7:
 %    \begin{macrocode}
-          \tl_set_eq:Nc \l_@@_front_tl
-                        { \@@_tl_csname:n { \l_@@_front_tl } }
+        \tl_set_eq:Nc \l_@@_front_tl
+                      { \@@_tl_csname:n { \l_@@_front_tl } }
 %    \end{macrocode}
 %
 %    This is step T8: If we haven't moved the code for all labels
@@ -2842,8 +2969,8 @@
 %    (i.e., if \cs{l_@@_labels_int} is still greater than zero) we
 %    have a loop and our partial order can't be flattened out.
 %    \begin{macrocode}
-       }
-  \int_compare:nNnF \l_@@_labels_int = 0
+      }
+    \int_compare:nNnF \l_@@_labels_int = 0
       {
         \iow_term:x{====================}
         \iow_term:x{Error:~ label~ rules~ are~ incompatible:}
@@ -2860,15 +2987,11 @@
 %    with adding extra code for a one time execution. That is stored
 %    in \verb=#2= but is normally empty.
 %    \begin{macrocode}
-  \tl_gput_right:Nn #1 {#2}
+    \tl_gput_right:Nn #1 {#2}
+  }
 %    \end{macrocode}
 %    
 %    \begin{macrocode}
-  \debug_resume:
-}
-%    \end{macrocode}
-%    
-%    \begin{macrocode}
 \cs_generate_variant:Nn \@@_initialize_single:NNNn {ccc}
 %    \end{macrocode}
 %  \end{macro}
@@ -3099,47 +3222,62 @@
 %
 %
 %
-%  \begin{macro}{\hook_log:n}
-%    This writes out information about the hook given in its argument
-%    onto the terminal and the \texttt{.log} file.
+% \begin{macro}{\hook_show:n,\hook_log:n}
+% \begin{macro}{\@@_log_line:x,\@@_log_line_indent:x}
+% \begin{macro}{\@@_log:nN}
+%   This writes out information about the hook given in its argument
+%   onto the \texttt{.log} file and the terminal, if \cs{show_hook:n} is
+%   used.  Internally both share the same structure, except that at the
+%   end, \cs{hook_show:n} triggers \TeX's prompt.
 %    \begin{macrocode}
 \cs_new_protected:Npn \hook_log:n #1
   {
-    \exp_args:Nx \@@_log:n
-      { \@@_parse_label_default:nn {#1} { top-level } }
+    \cs_set_eq:NN \@@_log_cmd:x \iow_log:x
+    \@@_normalize_hook_args:Nn \@@_log:nN {#1} \tl_log:x
   }
-\cs_new_protected:Npn \@@_log:n #1
+\cs_new_protected:Npn \hook_show:n #1
   {
+    \cs_set_eq:NN \@@_log_cmd:x \iow_term:x
+    \@@_normalize_hook_args:Nn \@@_log:nN {#1} \tl_show:x
+  }
+\cs_new_protected:Npn \@@_log_line:x #1
+  { \@@_log_cmd:x { >~#1 } }
+\cs_new_protected:Npn \@@_log_line_indent:x #1
+  { \@@_log_cmd:x { >~\@spaces #1 } }
+\cs_new_protected:Npn \@@_log:nN #1 #2
+  {
     \@@_preamble_hook:n {#1}
-    \iow_term:x{^^JThe~ hook~ '#1':}
+    \iow_term:x { ^^J ->~The~hook~'#1': }
 %    \end{macrocode}
 %    
 %    \begin{macrocode}
     \hook_if_exist:nF {#1}
-      { \iow_term:x {~Hook~ is~ not~ declared!} }
+      { \@@_log_line:x { is~not~declared! } }
     \@@_if_exist:nTF {#1}
       {
-        \iow_term:x{~Code~ chunks:}
-        \prop_if_empty:cTF {g_@@_#1_code_prop}
-          { \iow_term:x{\@spaces ---} }
+        \@@_log_line:x { Code~chunks: }
+        \prop_if_empty:cTF { g_@@_#1_code_prop }
+          { \@@_log_line_indent:x { --- } }
           {
-            \prop_map_inline:cn {g_@@_#1_code_prop}
-              { \iow_term:x{\@spaces ##1~ ->~ \tl_to_str:n{##2} } }
+            \prop_map_inline:cn { g_@@_#1_code_prop }
+              { \@@_log_line_indent:x { ##1~->~\tl_to_str:n {##2} } }
           }
 %    \end{macrocode}
 %    
 %    \begin{macrocode}
-        \iow_term:x{~Extra~ code~ next~ invocation:}
-        \iow_term:x{\@spaces
-          \tl_if_empty:cTF { g_@@_#1_code_next_tl }
-             {---}
+        \@@_log_line:x { Extra~code~for~next~invocation:}
+        \@@_log_line_indent:x
+          {
+            \tl_if_empty:cTF { @@_next~#1 }
+              { --- }
 %    \end{macrocode}
+%
 %    If the token list is not empty we want to display it but without
 %    the first tokens (the code to clear itself) so we call a helper
 %    command to  get rid of them.
 %    \begin{macrocode}
-             {->~  \exp_args:Nv
-                   \@@_log_next_code:n {g_@@_#1_code_next_tl} } }
+              { ->~ \exp_args:Nv \@@_log_next_code:n { @@_next~#1 } }
+          }
 %    \end{macrocode}
 %
 %   Loop through the rules in a hook and for every rule found, print it.
@@ -3146,55 +3284,73 @@
 %   If no rule is there, print |---|.  The boolean \cs{l_@@_tmpa_bool}
 %   here indicates if the hook has no rules.
 %    \begin{macrocode}
-        \iow_term:x { ~Rules: }
+        \@@_log_line:x { Rules: }
         \bool_set_true:N \l_@@_tmpa_bool
         \@@_list_rules:nn {#1}
           {
             \bool_set_false:N \l_@@_tmpa_bool
-            \iow_term:x
+            \@@_log_line_indent:x
               {
-                \@spaces ##2~ with~
+                ##2~ with~
                 \str_if_eq:nnT {##3} {??} { default~ }
-                relation~ ##1 }
+                relation~ ##1
+              }
           }
         \bool_if:NT \l_@@_tmpa_bool
-          { \iow_term:x { \@spaces --- } }
+          { \@@_log_line_indent:x { --- } }
 %    \end{macrocode}
-%    
+%
+%   When the hook is declared (that is, the sorting algorithm is applied
+%   to that hook) and not empty
 %    \begin{macrocode}
-        \bool_lazy_and:nnT
+        \bool_lazy_and:nnTF
             { \hook_if_exist_p:n {#1} }
             { ! \hook_if_empty_p:n {#1} }
-          { \iow_term:x { ~Execution~ order
-               \bool_if:NTF \l_@@_tmpa_bool
-                 { \@@_if_reversed:nT {#1}
-                        { ~ (after~ reversal) }
-                 }
-                 { ~ (after~
-                   \@@_if_reversed:nT {#1} {reversal~ and~}
-                   applying~ rules)
-                 }
-               :
+          {
+            \@@_log_line:x
+              {
+                Execution~order
+                \bool_if:NTF \l_@@_tmpa_bool
+                  { \@@_if_reversed:nT {#1} { ~(after~reversal) } }
+                  { ~(after~
+                    \@@_if_reversed:nT {#1} { reversal~and~ }
+                    applying~rules)
+                  } :
               }
-            \iow_term:x
-              { \@spaces \clist_use:cn {g_@@_#1_labels_clist} { ,~ } }
+            #2 % \tl_show:n
+              {
+                \@spaces
+                \clist_if_empty:cTF { g_@@_#1_labels_clist }
+                  { --- }
+                  { \clist_use:cn {g_@@_#1_labels_clist} { ,~ } }
+              }
           }
+          {
+            #2
+              {
+                Hook~ \hook_if_exist:nTF {#1}
+                  {code~pool~empty} {not~declared}
+              }
+          }
       }
-      { \iow_term:n { ~The~hook~is~empty. } }
-    \iow_term:n { }
+      { #2 { The~hook~is~empty. } }
   }
 %    \end{macrocode}
 %
+% \begin{macro}{\@@_log_next_code:n}
 %    To display the code for next invocation only (i.e., from
 %    \cs{AddToHookNext} we have to remove the first two tokens at the
 %    front which are \cs{tl_gclear:N} and the token list to clear.
 %    \begin{macrocode}
-\cs_new:Npn \@@_log_next_code:n #1 {
-  \exp_args:No \tl_to_str:n {\use_none:nn #1}
-}
+\cs_new:Npn \@@_log_next_code:n #1
+  { \exp_args:No \tl_to_str:n { \use_none:nn #1 } }
 %    \end{macrocode}
-%  \end{macro}
+% \end{macro}
 %
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
 % \begin{macro}{\@@_list_rules:nn}
 % \begin{macro}{\@@_list_one_rule:nnn,\@@_list_if_rule_exists:nnnF}
 %   This macro takes a \meta{hook} and an \meta{inline function} and
@@ -3266,25 +3422,29 @@
 %
 %  \subsection{Specifying code for next invocation}
 %
-%  \begin{macro}{\hook_gput_next_code:nn}
-%    
+% \begin{macro}{\hook_gput_next_code:nn}
+% \begin{macro}{%
+%     \@@_gput_next_code:nn,
+%     \@@_gput_next_do:nn,
+%     \@@_gput_next_do:Nnn,
+%     \@@_clear_next:n
+%   }
 %    \begin{macrocode}
 \cs_new_protected:Npn \hook_gput_next_code:nn #1
-  {
-    \exp_args:Nx \@@_gput_next_code:nn
-      { \@@_parse_label_default:nn {#1} { top-level } }
-  }
+  { \@@_normalize_hook_args:Nn \@@_gput_next_code:nn {#1} }
 \cs_new_protected:Npn \@@_gput_next_code:nn #1 #2
   {
+    \debug_suspend:
     \@@_declare:n {#1}
     \hook_if_exist:nTF {#1}
       { \@@_gput_next_do:nn {#1} {#2} }
       { \@@_try_declaring_generic_next_hook:nn {#1} {#2} }
+    \debug_resume:
   }
 \cs_new_protected:Npn \@@_gput_next_do:nn #1
   {
     \exp_args:Nc \@@_gput_next_do:Nnn
-      { g_@@_#1_code_next_tl } {#1}
+      { @@_next~#1 } {#1}
   }
 %    \end{macrocode}
 %   First check if the ``next code'' token list is empty:  if so we need
@@ -3299,14 +3459,17 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_gput_next_do:Nnn #1 #2
   {
-    \tl_if_empty:cT { g_@@_#2_code_tl }
+    \tl_if_empty:cT { @@~#2 }
       { \@@_update_hook_code:n {#2} }
     \tl_if_empty:NT #1
-      { \tl_gset:Nn #1 { \tl_gclear:c { g_@@_#2_code_next_tl } } }
+      { \tl_gset:Nn #1 { \@@_clear_next:n {#2} } }
     \tl_gput_right:Nn #1
   }
+\cs_new_protected:Npn \@@_clear_next:n #1
+  { \cs_gset_eq:cN { @@_next~#1 } \c_empty_tl }
 %    \end{macrocode}
 %  \end{macro}
+%  \end{macro}
 %
 %
 % \subsection{Using the hook}
@@ -3313,6 +3476,7 @@
 %
 % \begin{macro}{\hook_use:n}
 % \begin{macro}[EXP]{\@@_use_initialized:n}
+% \begin{macro}{\@@_use_undefined:w,\@@_use_end:}
 % \begin{macro}{\@@_preamble_hook:n}
 %   \cs{hook_use:n} as defined here is used in the preamble, where
 %   hooks aren't initialized by default.  \cs{@@_use_initialized:n} is
@@ -3340,25 +3504,34 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \hook_use:n #1
   {
-    \tl_if_exist:cTF { g_@@_#1_code_tl }
+    \tl_if_exist:cTF { @@~#1 }
       {
         \@@_preamble_hook:n {#1}
-        \cs:w g_@@_#1_code_tl \cs_end:
+        \cs:w @@~#1 \cs_end:
       }
       { \@@_use:wn #1 / \s_@@_mark {#1} }
   }
 \cs_new:Npn \@@_use_initialized:n #1
   {
-    \tl_if_exist:cTF { g_@@_#1_code_tl }
-      { \cs:w g_@@_#1_code_tl \cs_end: }
-      { \@@_use:wn #1 / \s_@@_mark {#1} }
+    \if_cs_exist:w @@~#1 \cs_end:
+    \else:
+      \@@_use_undefined:w
+    \fi:
+    \cs:w @@~#1 \@@_use_end:
   }
+\cs_new:Npn \@@_use_undefined:w #1 #2 @@~#3 \@@_use_end:
+  {
+    #1 % fi
+    \@@_use:wn #3 / \s_@@_mark {#3}
+  }
 \cs_new_protected:Npn \@@_preamble_hook:n #1
   { \@@_initialize_hook_code:n {#1} }
+\cs_new_eq:NN \@@_use_end: \cs_end:
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}[EXP]{\@@_use:wn}
 % \begin{macro}{\@@_try_file_hook:n,\@@_if_exist_use:n}
@@ -3391,10 +3564,10 @@
   }
 \cs_new_protected:Npn \@@_if_exist_use:n #1
   {
-    \tl_if_exist:cT { g_@@_#1_code_tl }
+    \tl_if_exist:cT { @@~#1 }
       {
         \@@_preamble_hook:n {#1}
-        \cs:w g_@@_#1_code_tl \cs_end:
+        \cs:w @@~#1 \cs_end:
       }
   }
 %    \end{macrocode}
@@ -3404,18 +3577,28 @@
 %  \begin{macro}{\hook_use_once:n}
 %    For hooks that can and should be used only once we have a special
 %    use command that remembers the hook name in
-%    \cs{g_@@_execute_immediately_clist}. This has the effect that any
+%    \cs{g_@@_execute_immediately_prop}. This has the effect that any
 %    further code added to the hook is executed immediately rather
 %    than stored in the hook.
+%
+%    The code needs some gymnastics to prevent space trimming from the
+%    hook name, since \cs{hook_use:n} and \cs{hook_use_once:n} are
+%    documented to not trim spaces.
+%
+%    \pho{Should this raise an error if the hook doesn't exist?}
 %    \begin{macrocode}
 \cs_new_protected:Npn \hook_use_once:n #1
   {
-    \tl_if_exist:cT { g_@@_#1_code_tl }
+    \tl_if_exist:cT { @@~#1 }
       {
-        \clist_gput_left:Nn \g_@@_execute_immediately_clist {#1}
+        \tl_set:Nn \l_@@_return_tl {#1}
+        \@@_normalize_hook_args:Nn \@@_use_once_store:n
+          { \l_@@_return_tl }
         \hook_use:n {#1}
       }
   }
+\cs_new_protected:Npn \@@_use_once_store:n #1
+  { \prop_gput:Nnn \g_@@_execute_immediately_prop {#1} { } }
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -3445,7 +3628,7 @@
 %   Test if a hook is empty (that is, no code was added to that hook).
 %   A hook being empty means that \emph{both} its
 %   \cs[no-index]{g_@@_\meta{hook}_code_prop} and its
-%   \cs[no-index]{g_@@_\meta{hook}_code_next_tl} are empty.
+%   \cs[no-index]{@@_next~\meta{hook}} are empty.
 %    \begin{macrocode}
 \prg_new_conditional:Npnn \hook_if_empty:n #1 { p , T , F , TF }
   {
@@ -3453,7 +3636,7 @@
       {
         \bool_lazy_and:nnTF
             { \prop_if_empty_p:c { g_@@_#1_code_prop } }
-            { \tl_if_empty_p:c { g_@@_#1_code_next_tl } }
+            { \tl_if_empty_p:c { @@_next~#1 } }
           { \prg_return_true: }
           { \prg_return_false: }
       }
@@ -3465,7 +3648,7 @@
 % \begin{macro}[pTF]{\hook_if_exist:n}
 %   A canonical way to test if a hook exists.  A hook exists if the
 %   token list that stores the sorted code for that hook,
-%   \cs[no-index]{g_@@_\meta{hook}_code_tl}, exists.  The property list
+%   \cs[no-index]{@@~\meta{hook}}, exists.  The property list
 %   \cs[no-index]{g_@@_\meta{hook}_code_prop} cannot be used here
 %   because often it is necessary to add code to a hook without knowing
 %   if such hook was already declared, or even if it will ever be
@@ -3473,7 +3656,7 @@
 %    \begin{macrocode}
 \prg_new_conditional:Npnn \hook_if_exist:n #1 { p , T , F , TF }
   {
-    \tl_if_exist:cTF { g_@@_#1_code_tl }
+    \tl_if_exist:cTF { @@~#1 }
       { \prg_return_true: }
       { \prg_return_false: }
   }
@@ -3510,13 +3693,6 @@
 % \end{macro}
 %
 %
-%  \begin{macro}{\g_@@_execute_immediately_clist}
-%    List of hooks that from no on should not longer receive code.
-%    \begin{macrocode}
-\clist_new:N \g_@@_execute_immediately_clist
-%    \end{macrocode}
-%  \end{macro}
-%
 %  \subsection{Messages}
 %
 %    \begin{macrocode}
@@ -3588,11 +3764,7 @@
 %    
 %    \begin{macrocode}
 \NewDocumentCommand \AddToHook { m o +m }
-  {
-    \clist_if_in:NnTF \g_@@_execute_immediately_clist {#1}
-      {#3}
-      { \hook_gput_code:nnn {#1} {#2} {#3} }
-  }
+  { \hook_gput_code:nnn {#1} {#2} {#3} }
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -3685,19 +3857,19 @@
 %    Avoid the overhead of \pkg{xparse} and its protection that we
 %    don't want here (since the hook should vanish without trace if empty)!
 %    \begin{macrocode}
-\newcommand \UseHook        { \hook_use:n }
-\newcommand \UseOneTimeHook { \hook_use_once:n }
+\cs_new:Npn \UseHook        { \hook_use:n }
+\cs_new:Npn \UseOneTimeHook { \hook_use_once:n }
 %    \end{macrocode}
 %  \end{macro}
 %
 %
 %
-%  \begin{macro}{\ShowHook}
-%    
+% \begin{macro}{\ShowHook,\LogHook}
 %    \begin{macrocode}
-\cs_new_protected:Npn \ShowHook { \hook_log:n }
+\cs_new_protected:Npn \ShowHook { \hook_show:n }
+\cs_new_protected:Npn \LogHook { \hook_log:n }
 %    \end{macrocode}
-%  \end{macro}
+% \end{macro}
 %
 %  \begin{macro}{\DebugHooksOn,\DebugHooksOff}
 %    
@@ -3722,7 +3894,7 @@
 %    \begin{macrocode}
 \NewDocumentCommand \DeclareDefaultHookRule { m m m }
                     { \hook_gset_rule:nnnn {??}{#1}{#2}{#3} }
-\@onlypreamble\DeclareDefaultHookRule                    
+\@onlypreamble\DeclareDefaultHookRule
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -3766,12 +3938,12 @@
 %    
 %    \begin{macrocode}
 \cs_new_eq:NN \@expl@@@initialize at all@@
-              \__hook_initialize_all:  
+              \__hook_initialize_all:
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\cs_new_eq:NN \@expl@@@hook at curr@name at push@@n 
-              \__hook_curr_name_push:n 
+\cs_new_eq:NN \@expl@@@hook at curr@name at push@@n
+              \__hook_curr_name_push:n
 %    \end{macrocode}
 %
 %    \begin{macrocode}

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltshipout.dtx	2020-09-11 20:57:29 UTC (rev 56324)
@@ -31,8 +31,8 @@
 %%% From File: ltshipout.dtx
 %
 %    \begin{macrocode}
-\providecommand\ltshipoutversion{v1.0a}
-\providecommand\ltshipoutdate{2020/08/31}
+\providecommand\ltshipoutversion{v1.0b}
+\providecommand\ltshipoutdate{2020/09/09}
 %    \end{macrocode}
 %
 %<*driver>
@@ -412,7 +412,7 @@
 %
 % \begin{function}{\AtBeginShipoutInit}
 %   By default \pkg{atbegshi} delayed its action until
-%    \verb=\beg{document}=.  This command was forcing it in an earlier
+%    \verb=\begin{document}=.  This command was forcing it in an earlier
 %    place. With the new concept it does nothing.
 % \end{function}
 %
@@ -1085,7 +1085,7 @@
 %    Put the argument into a \texttt{picture} environment that doesn't take up
 %    any size and uses \texttt{1pt} for \cs{unitlength}.
 %    \fmi{Could perhaps be generalized as it might be useful elsewhere. For
-%    not it is not.}
+%    now it is not.}
 %    \begin{macrocode}
 \cs_new:Npn \@@_picture_overlay:n #1 {
 %    \end{macrocode}
@@ -1100,8 +1100,15 @@
     \vbox_to_zero:n {
       \kern -\c_@@_vorigin_tl \scan_stop:
       \unitlength 1pt \scan_stop:
-      \hbox_set_to_wd:Nnn \l_@@_tmp_box \c_zero_dim { \ignorespaces #1 }
-%      \box_set_wd:Nn \l_@@_tmp_box \c_zero_dim
+%    \end{macrocode}
+%    This mimics a simple zero-sized picture environment. The \cs{hss}
+%    is need in case there is horizontal material (without using
+%    \cs{put} with a positive width.
+% \changes{v1.0b}{2020/09/09}
+%         {Prevent overfull box warnings (gh/387)}
+%    \begin{macrocode}
+      \hbox_set_to_wd:Nnn \l_@@_tmp_box \c_zero_dim
+                          { \ignorespaces #1 \hss }
       \box_set_ht:Nn \l_@@_tmp_box \c_zero_dim
       \box_set_dp:Nn \l_@@_tmp_box \c_zero_dim
       \box_use:N \l_@@_tmp_box
@@ -1567,7 +1574,7 @@
 %
 %    \begin{macrocode}
 %<*atbegshi-ltx>
-\ProvidesPackage{atbegshi}
+\ProvidesPackage{atbegshi-ltx}
    [2020/08/17 v1.0a
      Emulation of the original atbegshi package^^Jwith kernel methods]
 %    \end{macrocode}
@@ -1673,7 +1680,7 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\ProvidesPackage{everyshi}
+\ProvidesPackage{everyshi-ltx}
    [2020/08/17 v1.0a
     Emulation of the original everyshi package^^Jwith kernel methods]
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/source/latex-dev/base/ltvers.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex-dev/base/ltvers.dtx	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/source/latex-dev/base/ltvers.dtx	2020-09-11 20:57:29 UTC (rev 56324)
@@ -115,7 +115,7 @@
    {2020-10-01}
 %</2ekernel|latexrelease>
 %<*2ekernel>
-\def\patch at level{-8}
+\def\patch at level{-9}
 %    \end{macrocode}
 %
 % \begin{macro}{\development at branch@name}

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/atbegshi-ltx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/atbegshi-ltx.sty	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/atbegshi-ltx.sty	2020-09-11 20:57:29 UTC (rev 56324)
@@ -45,9 +45,9 @@
 %% File: ltshipout.dtx (C) Copyright 2020 Frank Mittelbach, LaTeX Team
 %%
 %%% From File: ltshipout.dtx
-\providecommand\ltshipoutversion{v1.0a}
-\providecommand\ltshipoutdate{2020/08/31}
-\ProvidesPackage{atbegshi}
+\providecommand\ltshipoutversion{v1.0b}
+\providecommand\ltshipoutdate{2020/09/09}
+\ProvidesPackage{atbegshi-ltx}
    [2020/08/17 v1.0a
      Emulation of the original atbegshi package^^Jwith kernel methods]
 \let \AtBeginShipoutBox \ShipoutBox

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/atveryend-ltx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/atveryend-ltx.sty	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/atveryend-ltx.sty	2020-09-11 20:57:29 UTC (rev 56324)
@@ -44,10 +44,10 @@
 %%
 %% File: ltfilehook.dtx (C) Copyright 2020 Frank Mittelbach,
 %%                                         Phelype Oleinik & LaTeX Team
-%%% From File: ltshipout.dtx
+%%% From File: ltfilehook.dtx
 \providecommand\ltfilehookversion{v1.0a}
 \providecommand\ltfilehookdate{2020/08/30}
-\ProvidesPackage{atveryend}
+\ProvidesPackage{atveryend-ltx}
    [2020/08/19 v1.0a
      Emulation of the original atvery package^^Jwith kernel methods]
 \newcommand\AfterLastShipout  {\AddToHook{enddocument/afterlastpage}}

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/everyshi-ltx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/everyshi-ltx.sty	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/everyshi-ltx.sty	2020-09-11 20:57:29 UTC (rev 56324)
@@ -45,9 +45,9 @@
 %% File: ltshipout.dtx (C) Copyright 2020 Frank Mittelbach, LaTeX Team
 %%
 %%% From File: ltshipout.dtx
-\providecommand\ltshipoutversion{v1.0a}
-\providecommand\ltshipoutdate{2020/08/31}
-\ProvidesPackage{everyshi}
+\providecommand\ltshipoutversion{v1.0b}
+\providecommand\ltshipoutdate{2020/09/09}
+\ProvidesPackage{everyshi-ltx}
    [2020/08/17 v1.0a
     Emulation of the original everyshi package^^Jwith kernel methods]
 \def \EveryShipout  {\AddToHook{shipout/before}}

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/filehook-ltx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/filehook-ltx.sty	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/filehook-ltx.sty	2020-09-11 20:57:29 UTC (rev 56324)
@@ -44,7 +44,7 @@
 %%
 %% File: ltfilehook.dtx (C) Copyright 2020 Frank Mittelbach,
 %%                                         Phelype Oleinik & LaTeX Team
-%%% From File: ltshipout.dtx
+%%% From File: ltfilehook.dtx
 \providecommand\ltfilehookversion{v1.0a}
 \providecommand\ltfilehookdate{2020/08/30}
 \newcommand\AtBeginOfEveryFile [1]

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/latex.ltx
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/latex.ltx	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/latex.ltx	2020-09-11 20:57:29 UTC (rev 56324)
@@ -710,7 +710,7 @@
 \def\fmtname{LaTeX2e}
 \edef\fmtversion
    {2020-10-01}
-\def\patch at level{-8}
+\def\patch at level{-9}
 \edef\development at branch@name{develop \the\year-\the\month-\the\day}
 \iffalse
 \def\reserved at a#1/#2/#3\@nil{%
@@ -1065,6 +1065,8 @@
 \cs_gset_eq:NN \@expl at cs@prefix at spec@@N \cs_prefix_spec:N
 \cs_gset_eq:NN \@expl at cs@argument at spec@@N \cs_argument_spec:N
 \cs_gset_eq:NN \@expl at cs@replacement at spec@@N \cs_replacement_spec:N
+\cs_gset_eq:NN \@expl at str@map at function@@NN \str_map_function:NN
+\cs_gset_eq:NN \@expl at char@generate@@nn \char_generate:nn
 \ExplSyntaxOff
 %%% From File: ltdefns.dtx
 \def\two at digits#1{\ifnum#1<10 0\fi\number#1}
@@ -1569,9 +1571,21 @@
   \edef #1{\expandafter\strip at prefix
            \meaning #1}%
 }
+\def\string at makeletter#1{%
+  \@expl at str@map at function@@NN#1\@string at makeletter}
+\def\@string at makeletter#1{%
+  \char at if@alph{#1}%
+    {\@expl at char@generate@@nn{`#1}{11}}%
+    {#1}}
+\def\char at if@alph#1{%
+  \ifnum0\ifnum`#1<`A 1\fi\ifnum`#1>`z 1\fi
+      \if\ifnum`#1>`Z @\fi\ifnum`#1<`a @\fi01\fi>0
+    \expandafter\@secondoftwo
+  \else
+    \expandafter\@firstoftwo
+  \fi}
 \DeclareRobustCommand\makeatletter{\catcode`\@11\relax}
 \DeclareRobustCommand\makeatother{\catcode`\@12\relax}
-
 \def\@latex at info#1{}
 \ifx\directlua\@undefined
   \DeclareRobustCommand{\-}{%
@@ -1615,7 +1629,7 @@
 %%                                      Phelype Oleinik & LaTeX Team
 %%% From File: lthooks.dtx
 \def\lthooksversion{v1.0a}
-\def\lthooksdate{2020/08/31}
+\def\lthooksdate{2020/09/10}
 \ExplSyntaxOn
 \bool_new:N \g__hook_debug_bool
 \cs_new_eq:NN \__hook_debug:n \use_none:n
@@ -1643,42 +1657,47 @@
 \tl_new:N \g__hook_removal_list_tl
 \tl_new:N \l__hook_cur_hook_tl
 \prop_new:N \l__hook_work_prop
+\prop_new:N \g__hook_execute_immediately_prop
+\prop_new:N \g__hook_used_prop
 \tl_new:N \g__hook_hook_curr_name_tl
 \seq_new:N \g__hook_name_stack_seq
 \cs_new_eq:NN \__hook_tmp:w ?
 \cs_generate_variant:Nn \tl_gremove_once:Nn { Nx }
+\cs_generate_variant:Nn \tl_show:n { x }
+\cs_generate_variant:Nn \tl_log:n { x }
 \scan_new:N \s__hook_mark
 \cs_new_protected:Npn \hook_new:n #1
+  { \__hook_normalize_hook_args:Nn \__hook_new:n {#1} }
+\cs_new_protected:Npn \__hook_new:n #1
   {
-    \exp_args:Nx \__hook_new:n
-      { \__hook_parse_label_default:nn {#1} { top-level } }
+    \hook_if_exist:nTF {#1}
+      { \msg_error:nnn { hooks } { exists } {#1} }
+      {
+        \seq_gput_right:Nn \g__hook_all_seq {#1}
+        \tl_new:c { __hook~#1 }
+        \__hook_declare:n {#1}
+        \clist_new:c {g__hook_#1_labels_clist}
+        \tl_new:c { g__hook_#1_reversed_tl }
+        \__hook_include_legacy_code_chunk:n {#1}
+     }
   }
-\cs_new_protected:Npn \__hook_new:n #1 {
-  \hook_if_exist:nTF {#1}
-       { \msg_error:nnn { hooks } { exists } {#1} }
-     { \seq_gput_right:Nn \g__hook_all_seq {#1}
-       \tl_new:c { g__hook_#1_code_tl }
-       \__hook_declare:n {#1}
-       \clist_new:c {g__hook_#1_labels_clist}
-       \tl_new:c { g__hook_#1_reversed_tl }
-       \__hook_include_legacy_code_chunk:n {#1}
-     }
-}
 \cs_new_protected:Npn \__hook_declare:n #1
   {
     \__hook_if_exist:nF {#1}
       {
         \prop_new:c { g__hook_#1_code_prop }
-        \tl_new:c { g__hook_#1_code_next_tl }
+        \tl_new:c { __hook_next~#1 }
       }
   }
-\cs_new_protected:Npn \hook_new_reversed:n #1 {
-  \hook_new:n {#1}
-  \tl_gset:cn { g__hook_#1_reversed_tl } { - }
-}
-\cs_new_protected:Npn \hook_new_pair:nn #1#2 {
-  \hook_new:n {#1}  \hook_new_reversed:n {#2}
-}
+\cs_new_protected:Npn \hook_new_reversed:n #1
+  { \__hook_normalize_hook_args:Nn \__hook_new_reversed:n {#1} }
+\cs_new_protected:Npn \__hook_new_reversed:n #1
+  {
+    \__hook_new:n {#1}
+    \tl_gset:cn { g__hook_#1_reversed_tl } { - }
+  }
+\cs_new_protected:Npn \hook_new_pair:nn #1#2
+  { \hook_new:n {#1} \hook_new_reversed:n {#2} }
 \cs_new_protected:Npn \__hook_include_legacy_code_chunk:n #1
   {
     \debug_suspend:
@@ -1693,13 +1712,15 @@
       }
     \debug_resume:
   }
-\cs_new:Npn \__hook_parse_label_default:nn #1 #2
+\cs_new:Npn \__hook_parse_label_default:n #1
   {
     \tl_if_novalue:nTF {#1}
-      { \__hook_currname_or_default:n {#2} }
-      { \tl_trim_spaces_apply:nN {#1} \__hook_parse_dot_label:nn {#2} }
+      { \__hook_currname_or_default:n { top-level } }
+      {
+        \tl_trim_spaces_apply:nN {#1}
+          \__hook_parse_dot_label:nn { top-level }
+      }
   }
-\cs_generate_variant:Nn \__hook_parse_label_default:nn { V }
 \cs_new:Npn \__hook_parse_dot_label:nn #1 #2
   {
     \tl_if_empty:nTF {#1}
@@ -1709,7 +1730,7 @@
       }
       {
         \str_if_eq:nnTF {#1} { . }
-          { \__hook_currname_or_default:n {#1} }
+          { \__hook_currname_or_default:n {#2} }
           { \__hook_parse_dot_label:nw {#2} #1 ./ \s__hook_mark }
       }
   }
@@ -1719,40 +1740,79 @@
       { \__hook_parse_dot_label_aux:nw {#1} #3 \s__hook_mark }
       {
         \tl_if_empty:nTF {#3}
-          {#2}
+          { \__hook_make_name:n {#2} }
           { \__hook_parse_dot_label_cleanup:w #2 ./ #3 \s__hook_mark }
       }
   }
 \cs_new:Npn \__hook_parse_dot_label_cleanup:w #1 ./ \s__hook_mark {#1}
 \cs_new:Npn \__hook_parse_dot_label_aux:nw #1 #2 ./ \s__hook_mark
-  { \__hook_currname_or_default:n {#1} / #2 }
+  { \__hook_currname_or_default:n {#1} / \__hook_make_name:n {#2} }
 \cs_new:Npn \__hook_currname_or_default:n #1
   {
     \tl_if_empty:NTF \g__hook_hook_curr_name_tl
       {
         \tl_if_empty:NTF \@currname
-          {#1}
+          { \__hook_make_name:n {#1} }
           { \@currname }
       }
       { \g__hook_hook_curr_name_tl }
   }
-\cs_new_protected:Npn \hook_gput_code:nnn #1 #2
+\cs_new:Npn \__hook_make_name:n #1
   {
-    \exp_args:Nxx \__hook_gput_code:nnn
-      { \__hook_parse_label_default:nn {#1} { top-level } }
-      { \__hook_parse_label_default:nn {#2} { top-level } }
+    \exp_after:wN \exp_after:wN \exp_after:wN \__hook_make_name:w
+    \exp_after:wN \token_to_str:N \cs:w __hook~ #1 \cs_end:
   }
+\exp_last_unbraced:NNNNo
+\cs_new:Npn \__hook_make_name:w #1 \tl_to_str:n { __hook~ } { }
+\cs_new_protected:Npn \__hook_normalize_hook_args_aux:Nn #1 #2
+  {
+    \group_begin:
+    \use:e
+      {
+        \group_end:
+        \exp_not:N #1 #2
+      }
+  }
+\cs_new_protected:Npn \__hook_normalize_hook_args:Nn #1 #2
+  {
+    \__hook_normalize_hook_args_aux:Nn #1
+      { { \__hook_parse_label_default:n {#2} } }
+  }
+\cs_new_protected:Npn \__hook_normalize_hook_args:Nnn #1 #2 #3
+  {
+    \__hook_normalize_hook_args_aux:Nn #1
+      {
+        { \__hook_parse_label_default:n {#2} }
+        { \__hook_parse_label_default:n {#3} }
+      }
+  }
+\cs_new_protected:Npn \__hook_normalize_hook_rule_args:Nnnnn #1 #2 #3 #4 #5
+  {
+    \__hook_normalize_hook_args_aux:Nn #1
+      {
+        { \__hook_parse_label_default:n {#2} }
+        { \__hook_parse_label_default:n {#3} }
+        { \tl_trim_spaces:n {#4} }
+        { \__hook_parse_label_default:n {#5} }
+      }
+  }
+\cs_new_protected:Npn \hook_gput_code:nnn #1 #2
+  { \__hook_normalize_hook_args:Nnn \__hook_gput_code:nnn {#1} {#2} }
 \cs_new_protected:Npn \__hook_gput_code:nnn #1 #2 #3
   {
-    \__hook_if_marked_removal:nnTF {#1} {#2}
-      { \__hook_unmark_removal:nn {#1} {#2} }
+    \prop_if_in:NnTF \g__hook_execute_immediately_prop {#1}
+      {#3}
       {
-        \hook_if_exist:nTF {#1}
+        \__hook_if_marked_removal:nnTF {#1} {#2}
+          { \__hook_unmark_removal:nn {#1} {#2} }
           {
-            \__hook_hook_gput_code_do:nnn {#1} {#2} {#3}
-            \__hook_update_hook_code:n {#1}
+            \hook_if_exist:nTF {#1}
+              {
+                \__hook_hook_gput_code_do:nnn {#1} {#2} {#3}
+                \__hook_update_hook_code:n {#1}
+              }
+              { \__hook_try_declaring_generic_hook:nnn {#1} {#2} {#3} }
           }
-          { \__hook_try_declaring_generic_hook:nnn {#1} {#2} {#3} }
       }
   }
 \cs_generate_variant:Nn \__hook_gput_code:nnn { nxv }
@@ -1852,11 +1912,7 @@
 \prop_const_from_keyval:Nn \c__hook_generics_reversed_iii_prop {after=}
 \prop_const_from_keyval:Nn \c__hook_generics_file_prop {before=,after=}
 \cs_new_protected:Npn \hook_gremove_code:nn #1 #2
-  {
-    \exp_args:Nxx \__hook_gremove_code:nn
-      { \__hook_parse_label_default:nn {#1} { top-level } }
-      { \__hook_parse_label_default:nn {#2} { top-level } }
-  }
+  { \__hook_normalize_hook_args:Nnn \__hook_gremove_code:nn {#1} {#2} }
 \cs_new_protected:Npn \__hook_gremove_code:nn #1 #2
   {
     \__hook_if_exist:nTF {#1}
@@ -1895,18 +1951,12 @@
 \cs_new:Npn \__hook_removal_tl:nn #1 #2
   { & \tl_to_str:n {#2} $ \tl_to_str:n {#1} $ }
 \prop_new:c {g__hook_??_code_prop}
-\prop_new:c {g__hook_??_code_tl}
+\prop_new:c {__hook~??}
 \tl_new:c {g__hook_??_reversed_tl}
 \cs_new_protected:Npn \hook_gset_rule:nnnn #1#2#3#4
   {
-    \use:x
-      {
-        \__hook_gset_rule:nnnn
-          { \__hook_parse_label_default:nn {#1} { top-level } }
-          { \__hook_parse_label_default:nn {#2} { top-level } }
-          {#3}
-          { \__hook_parse_label_default:nn {#4} { top-level } }
-      }
+    \__hook_normalize_hook_rule_args:Nnnnn \__hook_gset_rule:nnnn
+      {#1} {#2} {#3} {#4}
   }
 \cs_new_protected:Npn \__hook_gset_rule:nnnn #1#2#3#4
   {
@@ -1981,37 +2031,39 @@
      { \iow_term:x{^^JAll~ initialized~ (non-empty)~ hooks:}
        \prop_map_inline:Nn \g__hook_used_prop
            { \iow_term:x{^^J~ ##1~ ->~
-               \exp_not:v {g__hook_##1_code_tl}~ }
+               \exp_not:v {__hook~##1}~ }
            }
      }
   \cs_gset_eq:NN \hook_use:n \__hook_use_initialized:n
   \cs_gset_eq:NN \__hook_preamble_hook:n \use_none:n
 }
-\cs_new_protected:Npn \__hook_initialize_hook_code:n #1 {
-  \__hook_debug:n{ \iow_term:x{^^JUpdate~ code~ for~ hook~
-                                  '#1' \on at line :^^J} }
-  \__hook_include_legacy_code_chunk:n {#1}
-  \hook_if_exist:nT {#1}
-    {
-      \prop_if_empty:cTF {g__hook_#1_code_prop}
-        { \tl_gset:co {g__hook_#1_code_tl}
-                      {\cs:w g__hook_#1_code_next_tl \cs_end: } }
-        {
-          \__hook_if_reversed:nTF {#1}
-            { \cs_set_eq:NN \__hook_tl_gput:NV    \tl_gput_left:NV
-              \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_left:NV  }
-            { \cs_set_eq:NN \__hook_tl_gput:NV    \tl_gput_right:NV
-              \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_right:NV }
-          \prop_set_eq:Nc \l__hook_work_prop { g__hook_#1_code_prop }
-          \__hook_initialize_single:cccn
-            { g__hook_#1_code_tl } { g__hook_#1_code_next_tl }
-            { g__hook_#1_labels_clist } {#1}
-          \__hook_debug:n{ \exp_args:NNx \prop_gput:Nnn
-                                     \g__hook_used_prop {#1}{} }
-        }
-    }
-}
-\prop_new:N\g__hook_used_prop
+\cs_new_protected:Npn \__hook_initialize_hook_code:n #1
+  {
+    \debug_suspend:
+    \__hook_debug:n{ \iow_term:x{^^JUpdate~ code~ for~ hook~
+                                    '#1' \on at line :^^J} }
+    \__hook_include_legacy_code_chunk:n {#1}
+    \hook_if_exist:nT {#1}
+      {
+        \prop_if_empty:cTF {g__hook_#1_code_prop}
+          { \tl_gset:co { __hook~#1 }
+                        { \cs:w __hook_next~#1 \cs_end: } }
+          {
+            \__hook_if_reversed:nTF {#1}
+              { \cs_set_eq:NN \__hook_tl_gput:NV    \tl_gput_left:NV
+                \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_left:NV  }
+              { \cs_set_eq:NN \__hook_tl_gput:NV    \tl_gput_right:NV
+                \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_right:NV }
+            \prop_set_eq:Nc \l__hook_work_prop { g__hook_#1_code_prop }
+            \__hook_initialize_single:cccn
+              { __hook~#1 } { __hook_next~#1 }
+              { g__hook_#1_labels_clist } {#1}
+            \__hook_debug:n{ \exp_args:NNx \prop_gput:Nnn
+                                       \g__hook_used_prop {#1}{} }
+          }
+      }
+    \debug_resume:
+  }
 \cs_new:Npn \__hook_tl_csname:n #1 { l__hook_label_#1_tl }
 \cs_new:Npn \__hook_seq_csname:n #1 { l__hook_label_#1_seq }
 \seq_new:N \l__hook_labels_seq
@@ -2019,34 +2071,34 @@
 \tl_new:N \l__hook_front_tl
 \tl_new:N \l__hook_rear_tl
 \tl_new:c { \__hook_tl_csname:n { 0 } }
-\cs_new_protected:Npn \__hook_initialize_single:NNNn #1#2#3#4 {
-  \debug_suspend:
-  \seq_clear:N \l__hook_labels_seq
-  \int_zero:N  \l__hook_labels_int
-  \tl_set:Nn \l__hook_cur_hook_tl {#4}
-  \prop_map_inline:Nn \l__hook_work_prop
-     {
-       \int_incr:N \l__hook_labels_int
-       \seq_put_right:Nn \l__hook_labels_seq {##1}
-       \tl_set:cn { \__hook_tl_csname:n {##1} }{0}
-       \seq_clear_new:c { \__hook_seq_csname:n {##1} }
-     }
-  \prop_map_inline:Nn \l__hook_work_prop
-    {
-      \prop_map_inline:Nn \l__hook_work_prop
-        {
-          \__hook_if_label_case:nnnnn {##1} {####1}
-            { \prop_map_break: }
-            { \__hook_apply_label_pair:nnn {##1} {####1} }
-            { \__hook_apply_label_pair:nnn {####1} {##1} }
-                {#4}
-        }
-    }
-  \__hook_debug:n { \__hook_debug_label_data:N \l__hook_work_prop }
-  \tl_set:Nn \l__hook_rear_tl { 0 }
-  \tl_set:cn { \__hook_tl_csname:n { 0 } } { 0 }
-  \seq_map_inline:Nn \l__hook_labels_seq
+\cs_new_protected:Npn \__hook_initialize_single:NNNn #1#2#3#4
+  {
+    \seq_clear:N \l__hook_labels_seq
+    \int_zero:N  \l__hook_labels_int
+    \tl_set:Nn \l__hook_cur_hook_tl {#4}
+    \prop_map_inline:Nn \l__hook_work_prop
+       {
+         \int_incr:N \l__hook_labels_int
+         \seq_put_right:Nn \l__hook_labels_seq {##1}
+         \tl_set:cn { \__hook_tl_csname:n {##1} }{0}
+         \seq_clear_new:c { \__hook_seq_csname:n {##1} }
+       }
+    \prop_map_inline:Nn \l__hook_work_prop
       {
+        \prop_map_inline:Nn \l__hook_work_prop
+          {
+            \__hook_if_label_case:nnnnn {##1} {####1}
+              { \prop_map_break: }
+              { \__hook_apply_label_pair:nnn {##1} {####1} }
+              { \__hook_apply_label_pair:nnn {####1} {##1} }
+                  {#4}
+          }
+      }
+    \__hook_debug:n { \__hook_debug_label_data:N \l__hook_work_prop }
+    \tl_set:Nn \l__hook_rear_tl { 0 }
+    \tl_set:cn { \__hook_tl_csname:n { 0 } } { 0 }
+    \seq_map_inline:Nn \l__hook_labels_seq
+      {
         \int_compare:nNnT { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0
             {
               \tl_set:cn { \__hook_tl_csname:n { \l__hook_rear_tl } }{##1}
@@ -2053,42 +2105,41 @@
               \tl_set:Nn \l__hook_rear_tl {##1}
             }
       }
-  \tl_set_eq:Nc \l__hook_front_tl { \__hook_tl_csname:n { 0 } }
-  \tl_gclear:N #1
-  \clist_gclear:N #3
-  \bool_while_do:nn { ! \str_if_eq_p:Vn \l__hook_front_tl { 0 } }
-       {
-         \int_decr:N \l__hook_labels_int
-         \prop_get:NVN \l__hook_work_prop \l__hook_front_tl \l__hook_return_tl
-         \__hook_tl_gput:NV #1 \l__hook_return_tl
-         \__hook_clist_gput:NV #3 \l__hook_front_tl
-         \__hook_debug:n{ \iow_term:x{Handled~ code~ for~ \l__hook_front_tl} }
-         \seq_map_inline:cn { \__hook_seq_csname:n { \l__hook_front_tl } }
-             {
-               \tl_set:cx { \__hook_tl_csname:n {##1} }
-                          { \int_eval:n
-                              { \cs:w \__hook_tl_csname:n {##1} \cs_end: - 1 }
-                          }
-               \int_compare:nNnT
-                   { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0
-                   {
-                     \tl_set:cn { \__hook_tl_csname:n { \l__hook_rear_tl } } {##1}
-                     \tl_set:Nn \l__hook_rear_tl            {##1}
-                   }
-             }
-          \tl_set_eq:Nc \l__hook_front_tl
-                        { \__hook_tl_csname:n { \l__hook_front_tl } }
-       }
-  \int_compare:nNnF \l__hook_labels_int = 0
+    \tl_set_eq:Nc \l__hook_front_tl { \__hook_tl_csname:n { 0 } }
+    \tl_gclear:N #1
+    \clist_gclear:N #3
+    \bool_while_do:nn { ! \str_if_eq_p:Vn \l__hook_front_tl { 0 } }
       {
+        \int_decr:N \l__hook_labels_int
+        \prop_get:NVN \l__hook_work_prop \l__hook_front_tl \l__hook_return_tl
+        \__hook_tl_gput:NV #1 \l__hook_return_tl
+        \__hook_clist_gput:NV #3 \l__hook_front_tl
+        \__hook_debug:n{ \iow_term:x{Handled~ code~ for~ \l__hook_front_tl} }
+        \seq_map_inline:cn { \__hook_seq_csname:n { \l__hook_front_tl } }
+          {
+            \tl_set:cx { \__hook_tl_csname:n {##1} }
+                       { \int_eval:n
+                           { \cs:w \__hook_tl_csname:n {##1} \cs_end: - 1 }
+                       }
+            \int_compare:nNnT
+                { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0
+                {
+                  \tl_set:cn { \__hook_tl_csname:n { \l__hook_rear_tl } } {##1}
+                  \tl_set:Nn \l__hook_rear_tl            {##1}
+                }
+          }
+        \tl_set_eq:Nc \l__hook_front_tl
+                      { \__hook_tl_csname:n { \l__hook_front_tl } }
+      }
+    \int_compare:nNnF \l__hook_labels_int = 0
+      {
         \iow_term:x{====================}
         \iow_term:x{Error:~ label~ rules~ are~ incompatible:}
         \__hook_debug_label_data:N \l__hook_work_prop
         \iow_term:x{====================}
       }
-  \tl_gput_right:Nn #1 {#2}
-  \debug_resume:
-}
+    \tl_gput_right:Nn #1 {#2}
+  }
 \cs_generate_variant:Nn \__hook_initialize_single:NNNn {ccc}
 \cs_new:Npn \__hook_tl_gput:NV     {\ERROR}
 \cs_new:Npn \__hook_clist_gput:NV  {\ERROR}
@@ -2192,67 +2243,88 @@
 }
 \cs_new_protected:Npn \hook_log:n #1
   {
-    \exp_args:Nx \__hook_log:n
-      { \__hook_parse_label_default:nn {#1} { top-level } }
+    \cs_set_eq:NN \__hook_log_cmd:x \iow_log:x
+    \__hook_normalize_hook_args:Nn \__hook_log:nN {#1} \tl_log:x
   }
-\cs_new_protected:Npn \__hook_log:n #1
+\cs_new_protected:Npn \hook_show:n #1
   {
+    \cs_set_eq:NN \__hook_log_cmd:x \iow_term:x
+    \__hook_normalize_hook_args:Nn \__hook_log:nN {#1} \tl_show:x
+  }
+\cs_new_protected:Npn \__hook_log_line:x #1
+  { \__hook_log_cmd:x { >~#1 } }
+\cs_new_protected:Npn \__hook_log_line_indent:x #1
+  { \__hook_log_cmd:x { >~\@spaces #1 } }
+\cs_new_protected:Npn \__hook_log:nN #1 #2
+  {
     \__hook_preamble_hook:n {#1}
-    \iow_term:x{^^JThe~ hook~ '#1':}
+    \iow_term:x { ^^J ->~The~hook~'#1': }
     \hook_if_exist:nF {#1}
-      { \iow_term:x {~Hook~ is~ not~ declared!} }
+      { \__hook_log_line:x { is~not~declared! } }
     \__hook_if_exist:nTF {#1}
       {
-        \iow_term:x{~Code~ chunks:}
-        \prop_if_empty:cTF {g__hook_#1_code_prop}
-          { \iow_term:x{\@spaces ---} }
+        \__hook_log_line:x { Code~chunks: }
+        \prop_if_empty:cTF { g__hook_#1_code_prop }
+          { \__hook_log_line_indent:x { --- } }
           {
-            \prop_map_inline:cn {g__hook_#1_code_prop}
-              { \iow_term:x{\@spaces ##1~ ->~ \tl_to_str:n{##2} } }
+            \prop_map_inline:cn { g__hook_#1_code_prop }
+              { \__hook_log_line_indent:x { ##1~->~\tl_to_str:n {##2} } }
           }
-        \iow_term:x{~Extra~ code~ next~ invocation:}
-        \iow_term:x{\@spaces
-          \tl_if_empty:cTF { g__hook_#1_code_next_tl }
-             {---}
-             {->~  \exp_args:Nv
-                   \__hook_log_next_code:n {g__hook_#1_code_next_tl} } }
-        \iow_term:x { ~Rules: }
+        \__hook_log_line:x { Extra~code~for~next~invocation:}
+        \__hook_log_line_indent:x
+          {
+            \tl_if_empty:cTF { __hook_next~#1 }
+              { --- }
+              { ->~ \exp_args:Nv \__hook_log_next_code:n { __hook_next~#1 } }
+          }
+        \__hook_log_line:x { Rules: }
         \bool_set_true:N \l__hook_tmpa_bool
         \__hook_list_rules:nn {#1}
           {
             \bool_set_false:N \l__hook_tmpa_bool
-            \iow_term:x
+            \__hook_log_line_indent:x
               {
-                \@spaces ##2~ with~
+                ##2~ with~
                 \str_if_eq:nnT {##3} {??} { default~ }
-                relation~ ##1 }
+                relation~ ##1
+              }
           }
         \bool_if:NT \l__hook_tmpa_bool
-          { \iow_term:x { \@spaces --- } }
-        \bool_lazy_and:nnT
+          { \__hook_log_line_indent:x { --- } }
+        \bool_lazy_and:nnTF
             { \hook_if_exist_p:n {#1} }
             { ! \hook_if_empty_p:n {#1} }
-          { \iow_term:x { ~Execution~ order
-               \bool_if:NTF \l__hook_tmpa_bool
-                 { \__hook_if_reversed:nT {#1}
-                        { ~ (after~ reversal) }
-                 }
-                 { ~ (after~
-                   \__hook_if_reversed:nT {#1} {reversal~ and~}
-                   applying~ rules)
-                 }
-               :
+          {
+            \__hook_log_line:x
+              {
+                Execution~order
+                \bool_if:NTF \l__hook_tmpa_bool
+                  { \__hook_if_reversed:nT {#1} { ~(after~reversal) } }
+                  { ~(after~
+                    \__hook_if_reversed:nT {#1} { reversal~and~ }
+                    applying~rules)
+                  } :
               }
-            \iow_term:x
-              { \@spaces \clist_use:cn {g__hook_#1_labels_clist} { ,~ } }
+            #2 % \tl_show:n
+              {
+                \@spaces
+                \clist_if_empty:cTF { g__hook_#1_labels_clist }
+                  { --- }
+                  { \clist_use:cn {g__hook_#1_labels_clist} { ,~ } }
+              }
           }
+          {
+            #2
+              {
+                Hook~ \hook_if_exist:nTF {#1}
+                  {code~pool~empty} {not~declared}
+              }
+          }
       }
-      { \iow_term:n { ~The~hook~is~empty. } }
-    \iow_term:n { }
+      { #2 { The~hook~is~empty. } }
   }
-\cs_new:Npn \__hook_log_next_code:n #1 {
-  \exp_args:No \tl_to_str:n {\use_none:nn #1}
-}
+\cs_new:Npn \__hook_log_next_code:n #1
+  { \exp_args:No \tl_to_str:n { \use_none:nn #1 } }
 \cs_new_protected:Npn \__hook_list_rules:nn #1 #2
   {
     \cs_set_protected:Npn \__hook_tmp:w ##1 ##2 ##3 {#2}
@@ -2297,47 +2369,56 @@
     \exp_args:No \__hook_tmp:w { \use:nn { ~ } { ~ } }
   }
 \cs_new_protected:Npn \hook_gput_next_code:nn #1
-  {
-    \exp_args:Nx \__hook_gput_next_code:nn
-      { \__hook_parse_label_default:nn {#1} { top-level } }
-  }
+  { \__hook_normalize_hook_args:Nn \__hook_gput_next_code:nn {#1} }
 \cs_new_protected:Npn \__hook_gput_next_code:nn #1 #2
   {
+    \debug_suspend:
     \__hook_declare:n {#1}
     \hook_if_exist:nTF {#1}
       { \__hook_gput_next_do:nn {#1} {#2} }
       { \__hook_try_declaring_generic_next_hook:nn {#1} {#2} }
+    \debug_resume:
   }
 \cs_new_protected:Npn \__hook_gput_next_do:nn #1
   {
     \exp_args:Nc \__hook_gput_next_do:Nnn
-      { g__hook_#1_code_next_tl } {#1}
+      { __hook_next~#1 } {#1}
   }
 \cs_new_protected:Npn \__hook_gput_next_do:Nnn #1 #2
   {
-    \tl_if_empty:cT { g__hook_#2_code_tl }
+    \tl_if_empty:cT { __hook~#2 }
       { \__hook_update_hook_code:n {#2} }
     \tl_if_empty:NT #1
-      { \tl_gset:Nn #1 { \tl_gclear:c { g__hook_#2_code_next_tl } } }
+      { \tl_gset:Nn #1 { \__hook_clear_next:n {#2} } }
     \tl_gput_right:Nn #1
   }
+\cs_new_protected:Npn \__hook_clear_next:n #1
+  { \cs_gset_eq:cN { __hook_next~#1 } \c_empty_tl }
 \cs_new_protected:Npn \hook_use:n #1
   {
-    \tl_if_exist:cTF { g__hook_#1_code_tl }
+    \tl_if_exist:cTF { __hook~#1 }
       {
         \__hook_preamble_hook:n {#1}
-        \cs:w g__hook_#1_code_tl \cs_end:
+        \cs:w __hook~#1 \cs_end:
       }
       { \__hook_use:wn #1 / \s__hook_mark {#1} }
   }
 \cs_new:Npn \__hook_use_initialized:n #1
   {
-    \tl_if_exist:cTF { g__hook_#1_code_tl }
-      { \cs:w g__hook_#1_code_tl \cs_end: }
-      { \__hook_use:wn #1 / \s__hook_mark {#1} }
+    \if_cs_exist:w __hook~#1 \cs_end:
+    \else:
+      \__hook_use_undefined:w
+    \fi:
+    \cs:w __hook~#1 \__hook_use_end:
   }
+\cs_new:Npn \__hook_use_undefined:w #1 #2 __hook~#3 \__hook_use_end:
+  {
+    #1 % fi
+    \__hook_use:wn #3 / \s__hook_mark {#3}
+  }
 \cs_new_protected:Npn \__hook_preamble_hook:n #1
   { \__hook_initialize_hook_code:n {#1} }
+\cs_new_eq:NN \__hook_use_end: \cs_end:
 \cs_new:Npn \__hook_use:wn #1 / #2 \s__hook_mark #3
   {
     \str_if_eq:nnTF {#1} { file }
@@ -2355,20 +2436,24 @@
   }
 \cs_new_protected:Npn \__hook_if_exist_use:n #1
   {
-    \tl_if_exist:cT { g__hook_#1_code_tl }
+    \tl_if_exist:cT { __hook~#1 }
       {
         \__hook_preamble_hook:n {#1}
-        \cs:w g__hook_#1_code_tl \cs_end:
+        \cs:w __hook~#1 \cs_end:
       }
   }
 \cs_new_protected:Npn \hook_use_once:n #1
   {
-    \tl_if_exist:cT { g__hook_#1_code_tl }
+    \tl_if_exist:cT { __hook~#1 }
       {
-        \clist_gput_left:Nn \g__hook_execute_immediately_clist {#1}
+        \tl_set:Nn \l__hook_return_tl {#1}
+        \__hook_normalize_hook_args:Nn \__hook_use_once_store:n
+          { \l__hook_return_tl }
         \hook_use:n {#1}
       }
   }
+\cs_new_protected:Npn \__hook_use_once_store:n #1
+  { \prop_gput:Nnn \g__hook_execute_immediately_prop {#1} { } }
 \prg_new_conditional:Npnn \hook_if_empty:n #1 { p , T , F , TF }
   {
     \__hook_if_exist:nTF {#1}
@@ -2375,7 +2460,7 @@
       {
         \bool_lazy_and:nnTF
             { \prop_if_empty_p:c { g__hook_#1_code_prop } }
-            { \tl_if_empty_p:c { g__hook_#1_code_next_tl } }
+            { \tl_if_empty_p:c { __hook_next~#1 } }
           { \prg_return_true: }
           { \prg_return_false: }
       }
@@ -2383,7 +2468,7 @@
   }
 \prg_new_conditional:Npnn \hook_if_exist:n #1 { p , T , F , TF }
   {
-    \tl_if_exist:cTF { g__hook_#1_code_tl }
+    \tl_if_exist:cTF { __hook~#1 }
       { \prg_return_true: }
       { \prg_return_false: }
   }
@@ -2401,7 +2486,6 @@
       \prg_return_false:
     \fi:
   }
-\clist_new:N \g__hook_execute_immediately_clist
 \msg_new:nnnn { hooks } { labels-incompatible }
   {
     Labels~`#1'~and~`#2'~are~incompatible
@@ -2443,11 +2527,7 @@
 \NewDocumentCommand \NewReversedHook     { m }{ \hook_new_reversed:n {#1} }
 \NewDocumentCommand \NewMirroredHookPair { mm }{ \hook_new_pair:nn {#1}{#2} }
 \NewDocumentCommand \AddToHook { m o +m }
-  {
-    \clist_if_in:NnTF \g__hook_execute_immediately_clist {#1}
-      {#3}
-      { \hook_gput_code:nnn {#1} {#2} {#3} }
-  }
+  { \hook_gput_code:nnn {#1} {#2} {#3} }
 \NewDocumentCommand \AddToHookNext { m +m }
   { \hook_gput_next_code:nn {#1} {#2} }
 \NewDocumentCommand \RemoveFromHook { m o }
@@ -2473,9 +2553,10 @@
     \seq_gpop:NN \g__hook_name_stack_seq \l__hook_return_tl
     \__hook_curr_name_push:n {#1}
   }
-\newcommand \UseHook        { \hook_use:n }
-\newcommand \UseOneTimeHook { \hook_use_once:n }
-\cs_new_protected:Npn \ShowHook { \hook_log:n }
+\cs_new:Npn \UseHook        { \hook_use:n }
+\cs_new:Npn \UseOneTimeHook { \hook_use_once:n }
+\cs_new_protected:Npn \ShowHook { \hook_show:n }
+\cs_new_protected:Npn \LogHook { \hook_log:n }
 \cs_new_protected:Npn \DebugHooksOn  { \hook_debug_on:  }
 \cs_new_protected:Npn \DebugHooksOff { \hook_debug_off: }
 \NewDocumentCommand \DeclareHookRule { m m m m }
@@ -3107,7 +3188,7 @@
 
 \edef \@kernel at after@begindocument at before {%
   \let\expandafter\noexpand\csname
-       g__hook_env/document/begin_code_tl\endcsname
+       __hook env/document/begin\endcsname
   \noexpand\@empty}
 \let \@kernel at before@begindocument \@empty
 \let \@kernel at after@begindocument \@empty
@@ -9684,9 +9765,10 @@
     \@makeother\&%
     \kernel at ifnextchar[{\@providesfile{#1}}{\@providesfile{#1}[]}}
 \def\@pass at ptions#1#2#3{%
-  \expandafter\xdef\csname opt@#3.#1\endcsname{%
-    \@ifundefined{opt@#3.#1}\@empty
-      {\csname opt@#3.#1\endcsname,}%
+  \edef\reserved at a{\@expl@@@filehook at resolve@file at subst@@w #3.#1\@nil}%
+  \expandafter\xdef\csname opt@\reserved at a\endcsname{%
+    \@ifundefined{opt@\reserved at a}\@empty
+      {\csname opt@\reserved at a\endcsname,}%
     \zap at space#2 \@empty}}
 \@onlypreamble\@pass at ptions
 \def\PassOptionsToPackage{\@pass at ptions\@pkgextension}
@@ -9880,7 +9962,6 @@
   \fi
   \reserved at a}
 \@onlypreamble\@fileswith at pti@ns
-
 \def\@onefilewithoptions#1[#2][#3]#4{%
   \@pushfilename
   \xdef\@currname{#1}%
@@ -9913,6 +9994,13 @@
          {\@expl@@@filehook at file@push@@
           \set at curr@file{\@currname.\@currext}%
           \@filehook at set@CurrentFile
+          \edef\@currpkg at reqd{\@currname.\@currext}%
+          \ifx\CurrentFile\CurrentFileUsed
+          \else
+            \filename at parse\@curr at file
+            \edef\@currname{\string at makeletter\filename at base}%
+            \edef\@currext{\string at makeletter\filename at ext}%
+          \fi
           \load at onefile@withoptions{#2}%
           \@expl@@@filehook at file@pop@@}%
        \expandafter\@firstofone
@@ -9930,7 +10018,6 @@
     \@reset at ptions}
 \@onlypreamble\@onefilewithoptions
 \let\@unprocessedoptions\@undefined
-
 \def\@missing at onefilewithoptions#1{%
   \@missingfileerror\@currname\@currext
   \xdef\@currname{\@missingfile at area\@missingfile at base}%
@@ -9952,7 +10039,9 @@
         \UseHook{class/before/\@currname}%
       \fi
     \fi
-    \InputIfFileExists{\@currname.\@currext}{}{}%
+    \InputIfFileExists{\@currpkg at reqd}{}%
+      {\@latex at error
+        {The \@cls at pkg\space\@currpkg at reqd\space failed to load.}\@ehd}%
     \expandafter\let\csname unprocessedoptions-\@currname.\@currext\endcsname
                     \@@unprocessedoptions
     \csname\@currname.\@currext-h@@k\endcsname
@@ -9975,7 +10064,7 @@
         \UseHook{class/after}%
       \fi
     \fi}%
-  \reserved at a}
+  \@ifl at aded\@currext\@currname{}{\reserved at a}}
 \let\@@fileswith at pti@ns\@fileswith at pti@ns
 \@onlypreamble\@@fileswith at pti@ns
 \def\@reset at ptions{%
@@ -10376,7 +10465,7 @@
 %%
 %% File: ltfilehook.dtx (C) Copyright 2020 Frank Mittelbach,
 %%                                         Phelype Oleinik & LaTeX Team
-%%% From File: ltshipout.dtx
+%%% From File: ltfilehook.dtx
 \providecommand\ltfilehookversion{v1.0a}
 \providecommand\ltfilehookdate{2020/08/30}
 \ExplSyntaxOn
@@ -10636,8 +10725,8 @@
 %% File: ltshipout.dtx (C) Copyright 2020 Frank Mittelbach, LaTeX Team
 %%
 %%% From File: ltshipout.dtx
-\providecommand\ltshipoutversion{v1.0a}
-\providecommand\ltshipoutdate{2020/08/31}
+\providecommand\ltshipoutversion{v1.0b}
+\providecommand\ltshipoutdate{2020/09/09}
 \ExplSyntaxOn
 \bool_new:N \g__shipout_debug_bool
 \cs_new_eq:NN \__shipout_debug:n  \use_none:n
@@ -10883,7 +10972,8 @@
     \vbox_to_zero:n {
       \kern -\c__shipout_vorigin_tl \scan_stop:
       \unitlength 1pt \scan_stop:
-      \hbox_set_to_wd:Nnn \l__shipout_tmp_box \c_zero_dim { \ignorespaces #1 }
+      \hbox_set_to_wd:Nnn \l__shipout_tmp_box \c_zero_dim
+                          { \ignorespaces #1 \hss }
       \box_set_ht:Nn \l__shipout_tmp_box \c_zero_dim
       \box_set_dp:Nn \l__shipout_tmp_box \c_zero_dim
       \box_use:N \l__shipout_tmp_box

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/latexrelease.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/latexrelease.sty	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/latexrelease.sty	2020-09-11 20:57:29 UTC (rev 56324)
@@ -521,6 +521,8 @@
 \cs_gset_eq:NN \@expl at cs@prefix at spec@@N \cs_prefix_spec:N
 \cs_gset_eq:NN \@expl at cs@argument at spec@@N \cs_argument_spec:N
 \cs_gset_eq:NN \@expl at cs@replacement at spec@@N \cs_replacement_spec:N
+\cs_gset_eq:NN \@expl at str@map at function@@NN \str_map_function:NN
+\cs_gset_eq:NN \@expl at char@generate@@nn \char_generate:nn
 \EndIncludeInRelease
 \IncludeInRelease{0000/00/00}{expl3~2020-10-01}%
         {expl3~macros~added~for~the~2020-10-01~release}%
@@ -529,6 +531,7 @@
 \cs_undefine:N \@expl at cs@prefix at spec@@N
 \cs_undefine:N \@expl at cs@argument at spec@@N
 \cs_undefine:N \@expl at cs@replacement at spec@@N
+\cs_undefine:N \@expl at str@map at function@@NN
 \EndIncludeInRelease
 \ExplSyntaxOff
 %%% From File: ltdefns.dtx
@@ -912,6 +915,28 @@
     \expandafter\@secondoftwo
   \fi}
 \EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\string at makeletter}
+  {Add \string at makeletter}%
+\def\string at makeletter#1{%
+  \@expl at str@map at function@@NN#1\@string at makeletter}
+\def\@string at makeletter#1{%
+  \char at if@alph{#1}%
+    {\@expl at char@generate@@nn{`#1}{11}}%
+    {#1}}
+\def\char at if@alph#1{%
+  \ifnum0\ifnum`#1<`A 1\fi\ifnum`#1>`z 1\fi
+      \if\ifnum`#1>`Z @\fi\ifnum`#1<`a @\fi01\fi>0
+    \expandafter\@secondoftwo
+  \else
+    \expandafter\@firstoftwo
+  \fi}
+\EndIncludeInRelease
+\IncludeInRelease{0000/00/00}{\string at makeletter}
+  {Undefine \string at makeletter}%
+\let\string at makeletter\@undefined
+\let\@string at makeletter\@undefined
+\let\char at if@alph\@undefined
+\EndIncludeInRelease
 \IncludeInRelease{2020/10/01}{\-}{Use primitive \- in Lua\LaTeX}%
 \ifx\directlua\@undefined
   \DeclareRobustCommand{\-}{%
@@ -987,7 +1012,7 @@
 %%                                      Phelype Oleinik & LaTeX Team
 %%% From File: lthooks.dtx
 \def\lthooksversion{v1.0a}
-\def\lthooksdate{2020/08/31}
+\def\lthooksdate{2020/09/10}
 \IncludeInRelease{2020/10/01}%
                  {\NewHook}{The hook management}%
 \ExplSyntaxOn
@@ -1017,42 +1042,47 @@
 \tl_new:N \g__hook_removal_list_tl
 \tl_new:N \l__hook_cur_hook_tl
 \prop_new:N \l__hook_work_prop
+\prop_new:N \g__hook_execute_immediately_prop
+\prop_new:N \g__hook_used_prop
 \tl_new:N \g__hook_hook_curr_name_tl
 \seq_new:N \g__hook_name_stack_seq
 \cs_new_eq:NN \__hook_tmp:w ?
 \cs_generate_variant:Nn \tl_gremove_once:Nn { Nx }
+\cs_generate_variant:Nn \tl_show:n { x }
+\cs_generate_variant:Nn \tl_log:n { x }
 \scan_new:N \s__hook_mark
 \cs_new_protected:Npn \hook_new:n #1
+  { \__hook_normalize_hook_args:Nn \__hook_new:n {#1} }
+\cs_new_protected:Npn \__hook_new:n #1
   {
-    \exp_args:Nx \__hook_new:n
-      { \__hook_parse_label_default:nn {#1} { top-level } }
+    \hook_if_exist:nTF {#1}
+      { \msg_error:nnn { hooks } { exists } {#1} }
+      {
+        \seq_gput_right:Nn \g__hook_all_seq {#1}
+        \tl_new:c { __hook~#1 }
+        \__hook_declare:n {#1}
+        \clist_new:c {g__hook_#1_labels_clist}
+        \tl_new:c { g__hook_#1_reversed_tl }
+        \__hook_include_legacy_code_chunk:n {#1}
+     }
   }
-\cs_new_protected:Npn \__hook_new:n #1 {
-  \hook_if_exist:nTF {#1}
-       { \msg_error:nnn { hooks } { exists } {#1} }
-     { \seq_gput_right:Nn \g__hook_all_seq {#1}
-       \tl_new:c { g__hook_#1_code_tl }
-       \__hook_declare:n {#1}
-       \clist_new:c {g__hook_#1_labels_clist}
-       \tl_new:c { g__hook_#1_reversed_tl }
-       \__hook_include_legacy_code_chunk:n {#1}
-     }
-}
 \cs_new_protected:Npn \__hook_declare:n #1
   {
     \__hook_if_exist:nF {#1}
       {
         \prop_new:c { g__hook_#1_code_prop }
-        \tl_new:c { g__hook_#1_code_next_tl }
+        \tl_new:c { __hook_next~#1 }
       }
   }
-\cs_new_protected:Npn \hook_new_reversed:n #1 {
-  \hook_new:n {#1}
-  \tl_gset:cn { g__hook_#1_reversed_tl } { - }
-}
-\cs_new_protected:Npn \hook_new_pair:nn #1#2 {
-  \hook_new:n {#1}  \hook_new_reversed:n {#2}
-}
+\cs_new_protected:Npn \hook_new_reversed:n #1
+  { \__hook_normalize_hook_args:Nn \__hook_new_reversed:n {#1} }
+\cs_new_protected:Npn \__hook_new_reversed:n #1
+  {
+    \__hook_new:n {#1}
+    \tl_gset:cn { g__hook_#1_reversed_tl } { - }
+  }
+\cs_new_protected:Npn \hook_new_pair:nn #1#2
+  { \hook_new:n {#1} \hook_new_reversed:n {#2} }
 \cs_new_protected:Npn \__hook_include_legacy_code_chunk:n #1
   {
     \debug_suspend:
@@ -1067,13 +1097,15 @@
       }
     \debug_resume:
   }
-\cs_new:Npn \__hook_parse_label_default:nn #1 #2
+\cs_new:Npn \__hook_parse_label_default:n #1
   {
     \tl_if_novalue:nTF {#1}
-      { \__hook_currname_or_default:n {#2} }
-      { \tl_trim_spaces_apply:nN {#1} \__hook_parse_dot_label:nn {#2} }
+      { \__hook_currname_or_default:n { top-level } }
+      {
+        \tl_trim_spaces_apply:nN {#1}
+          \__hook_parse_dot_label:nn { top-level }
+      }
   }
-\cs_generate_variant:Nn \__hook_parse_label_default:nn { V }
 \cs_new:Npn \__hook_parse_dot_label:nn #1 #2
   {
     \tl_if_empty:nTF {#1}
@@ -1083,7 +1115,7 @@
       }
       {
         \str_if_eq:nnTF {#1} { . }
-          { \__hook_currname_or_default:n {#1} }
+          { \__hook_currname_or_default:n {#2} }
           { \__hook_parse_dot_label:nw {#2} #1 ./ \s__hook_mark }
       }
   }
@@ -1093,40 +1125,79 @@
       { \__hook_parse_dot_label_aux:nw {#1} #3 \s__hook_mark }
       {
         \tl_if_empty:nTF {#3}
-          {#2}
+          { \__hook_make_name:n {#2} }
           { \__hook_parse_dot_label_cleanup:w #2 ./ #3 \s__hook_mark }
       }
   }
 \cs_new:Npn \__hook_parse_dot_label_cleanup:w #1 ./ \s__hook_mark {#1}
 \cs_new:Npn \__hook_parse_dot_label_aux:nw #1 #2 ./ \s__hook_mark
-  { \__hook_currname_or_default:n {#1} / #2 }
+  { \__hook_currname_or_default:n {#1} / \__hook_make_name:n {#2} }
 \cs_new:Npn \__hook_currname_or_default:n #1
   {
     \tl_if_empty:NTF \g__hook_hook_curr_name_tl
       {
         \tl_if_empty:NTF \@currname
-          {#1}
+          { \__hook_make_name:n {#1} }
           { \@currname }
       }
       { \g__hook_hook_curr_name_tl }
   }
-\cs_new_protected:Npn \hook_gput_code:nnn #1 #2
+\cs_new:Npn \__hook_make_name:n #1
   {
-    \exp_args:Nxx \__hook_gput_code:nnn
-      { \__hook_parse_label_default:nn {#1} { top-level } }
-      { \__hook_parse_label_default:nn {#2} { top-level } }
+    \exp_after:wN \exp_after:wN \exp_after:wN \__hook_make_name:w
+    \exp_after:wN \token_to_str:N \cs:w __hook~ #1 \cs_end:
   }
+\exp_last_unbraced:NNNNo
+\cs_new:Npn \__hook_make_name:w #1 \tl_to_str:n { __hook~ } { }
+\cs_new_protected:Npn \__hook_normalize_hook_args_aux:Nn #1 #2
+  {
+    \group_begin:
+    \use:e
+      {
+        \group_end:
+        \exp_not:N #1 #2
+      }
+  }
+\cs_new_protected:Npn \__hook_normalize_hook_args:Nn #1 #2
+  {
+    \__hook_normalize_hook_args_aux:Nn #1
+      { { \__hook_parse_label_default:n {#2} } }
+  }
+\cs_new_protected:Npn \__hook_normalize_hook_args:Nnn #1 #2 #3
+  {
+    \__hook_normalize_hook_args_aux:Nn #1
+      {
+        { \__hook_parse_label_default:n {#2} }
+        { \__hook_parse_label_default:n {#3} }
+      }
+  }
+\cs_new_protected:Npn \__hook_normalize_hook_rule_args:Nnnnn #1 #2 #3 #4 #5
+  {
+    \__hook_normalize_hook_args_aux:Nn #1
+      {
+        { \__hook_parse_label_default:n {#2} }
+        { \__hook_parse_label_default:n {#3} }
+        { \tl_trim_spaces:n {#4} }
+        { \__hook_parse_label_default:n {#5} }
+      }
+  }
+\cs_new_protected:Npn \hook_gput_code:nnn #1 #2
+  { \__hook_normalize_hook_args:Nnn \__hook_gput_code:nnn {#1} {#2} }
 \cs_new_protected:Npn \__hook_gput_code:nnn #1 #2 #3
   {
-    \__hook_if_marked_removal:nnTF {#1} {#2}
-      { \__hook_unmark_removal:nn {#1} {#2} }
+    \prop_if_in:NnTF \g__hook_execute_immediately_prop {#1}
+      {#3}
       {
-        \hook_if_exist:nTF {#1}
+        \__hook_if_marked_removal:nnTF {#1} {#2}
+          { \__hook_unmark_removal:nn {#1} {#2} }
           {
-            \__hook_hook_gput_code_do:nnn {#1} {#2} {#3}
-            \__hook_update_hook_code:n {#1}
+            \hook_if_exist:nTF {#1}
+              {
+                \__hook_hook_gput_code_do:nnn {#1} {#2} {#3}
+                \__hook_update_hook_code:n {#1}
+              }
+              { \__hook_try_declaring_generic_hook:nnn {#1} {#2} {#3} }
           }
-          { \__hook_try_declaring_generic_hook:nnn {#1} {#2} {#3} }
       }
   }
 \cs_generate_variant:Nn \__hook_gput_code:nnn { nxv }
@@ -1226,11 +1297,7 @@
 \prop_const_from_keyval:Nn \c__hook_generics_reversed_iii_prop {after=}
 \prop_const_from_keyval:Nn \c__hook_generics_file_prop {before=,after=}
 \cs_new_protected:Npn \hook_gremove_code:nn #1 #2
-  {
-    \exp_args:Nxx \__hook_gremove_code:nn
-      { \__hook_parse_label_default:nn {#1} { top-level } }
-      { \__hook_parse_label_default:nn {#2} { top-level } }
-  }
+  { \__hook_normalize_hook_args:Nnn \__hook_gremove_code:nn {#1} {#2} }
 \cs_new_protected:Npn \__hook_gremove_code:nn #1 #2
   {
     \__hook_if_exist:nTF {#1}
@@ -1269,18 +1336,12 @@
 \cs_new:Npn \__hook_removal_tl:nn #1 #2
   { & \tl_to_str:n {#2} $ \tl_to_str:n {#1} $ }
 \prop_new:c {g__hook_??_code_prop}
-\prop_new:c {g__hook_??_code_tl}
+\prop_new:c {__hook~??}
 \tl_new:c {g__hook_??_reversed_tl}
 \cs_new_protected:Npn \hook_gset_rule:nnnn #1#2#3#4
   {
-    \use:x
-      {
-        \__hook_gset_rule:nnnn
-          { \__hook_parse_label_default:nn {#1} { top-level } }
-          { \__hook_parse_label_default:nn {#2} { top-level } }
-          {#3}
-          { \__hook_parse_label_default:nn {#4} { top-level } }
-      }
+    \__hook_normalize_hook_rule_args:Nnnnn \__hook_gset_rule:nnnn
+      {#1} {#2} {#3} {#4}
   }
 \cs_new_protected:Npn \__hook_gset_rule:nnnn #1#2#3#4
   {
@@ -1355,37 +1416,39 @@
      { \iow_term:x{^^JAll~ initialized~ (non-empty)~ hooks:}
        \prop_map_inline:Nn \g__hook_used_prop
            { \iow_term:x{^^J~ ##1~ ->~
-               \exp_not:v {g__hook_##1_code_tl}~ }
+               \exp_not:v {__hook~##1}~ }
            }
      }
   \cs_gset_eq:NN \hook_use:n \__hook_use_initialized:n
   \cs_gset_eq:NN \__hook_preamble_hook:n \use_none:n
 }
-\cs_new_protected:Npn \__hook_initialize_hook_code:n #1 {
-  \__hook_debug:n{ \iow_term:x{^^JUpdate~ code~ for~ hook~
-                                  '#1' \on at line :^^J} }
-  \__hook_include_legacy_code_chunk:n {#1}
-  \hook_if_exist:nT {#1}
-    {
-      \prop_if_empty:cTF {g__hook_#1_code_prop}
-        { \tl_gset:co {g__hook_#1_code_tl}
-                      {\cs:w g__hook_#1_code_next_tl \cs_end: } }
-        {
-          \__hook_if_reversed:nTF {#1}
-            { \cs_set_eq:NN \__hook_tl_gput:NV    \tl_gput_left:NV
-              \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_left:NV  }
-            { \cs_set_eq:NN \__hook_tl_gput:NV    \tl_gput_right:NV
-              \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_right:NV }
-          \prop_set_eq:Nc \l__hook_work_prop { g__hook_#1_code_prop }
-          \__hook_initialize_single:cccn
-            { g__hook_#1_code_tl } { g__hook_#1_code_next_tl }
-            { g__hook_#1_labels_clist } {#1}
-          \__hook_debug:n{ \exp_args:NNx \prop_gput:Nnn
-                                     \g__hook_used_prop {#1}{} }
-        }
-    }
-}
-\prop_new:N\g__hook_used_prop
+\cs_new_protected:Npn \__hook_initialize_hook_code:n #1
+  {
+    \debug_suspend:
+    \__hook_debug:n{ \iow_term:x{^^JUpdate~ code~ for~ hook~
+                                    '#1' \on at line :^^J} }
+    \__hook_include_legacy_code_chunk:n {#1}
+    \hook_if_exist:nT {#1}
+      {
+        \prop_if_empty:cTF {g__hook_#1_code_prop}
+          { \tl_gset:co { __hook~#1 }
+                        { \cs:w __hook_next~#1 \cs_end: } }
+          {
+            \__hook_if_reversed:nTF {#1}
+              { \cs_set_eq:NN \__hook_tl_gput:NV    \tl_gput_left:NV
+                \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_left:NV  }
+              { \cs_set_eq:NN \__hook_tl_gput:NV    \tl_gput_right:NV
+                \cs_set_eq:NN \__hook_clist_gput:NV \clist_gput_right:NV }
+            \prop_set_eq:Nc \l__hook_work_prop { g__hook_#1_code_prop }
+            \__hook_initialize_single:cccn
+              { __hook~#1 } { __hook_next~#1 }
+              { g__hook_#1_labels_clist } {#1}
+            \__hook_debug:n{ \exp_args:NNx \prop_gput:Nnn
+                                       \g__hook_used_prop {#1}{} }
+          }
+      }
+    \debug_resume:
+  }
 \cs_new:Npn \__hook_tl_csname:n #1 { l__hook_label_#1_tl }
 \cs_new:Npn \__hook_seq_csname:n #1 { l__hook_label_#1_seq }
 \seq_new:N \l__hook_labels_seq
@@ -1393,34 +1456,34 @@
 \tl_new:N \l__hook_front_tl
 \tl_new:N \l__hook_rear_tl
 \tl_new:c { \__hook_tl_csname:n { 0 } }
-\cs_new_protected:Npn \__hook_initialize_single:NNNn #1#2#3#4 {
-  \debug_suspend:
-  \seq_clear:N \l__hook_labels_seq
-  \int_zero:N  \l__hook_labels_int
-  \tl_set:Nn \l__hook_cur_hook_tl {#4}
-  \prop_map_inline:Nn \l__hook_work_prop
-     {
-       \int_incr:N \l__hook_labels_int
-       \seq_put_right:Nn \l__hook_labels_seq {##1}
-       \tl_set:cn { \__hook_tl_csname:n {##1} }{0}
-       \seq_clear_new:c { \__hook_seq_csname:n {##1} }
-     }
-  \prop_map_inline:Nn \l__hook_work_prop
-    {
-      \prop_map_inline:Nn \l__hook_work_prop
-        {
-          \__hook_if_label_case:nnnnn {##1} {####1}
-            { \prop_map_break: }
-            { \__hook_apply_label_pair:nnn {##1} {####1} }
-            { \__hook_apply_label_pair:nnn {####1} {##1} }
-                {#4}
-        }
-    }
-  \__hook_debug:n { \__hook_debug_label_data:N \l__hook_work_prop }
-  \tl_set:Nn \l__hook_rear_tl { 0 }
-  \tl_set:cn { \__hook_tl_csname:n { 0 } } { 0 }
-  \seq_map_inline:Nn \l__hook_labels_seq
+\cs_new_protected:Npn \__hook_initialize_single:NNNn #1#2#3#4
+  {
+    \seq_clear:N \l__hook_labels_seq
+    \int_zero:N  \l__hook_labels_int
+    \tl_set:Nn \l__hook_cur_hook_tl {#4}
+    \prop_map_inline:Nn \l__hook_work_prop
+       {
+         \int_incr:N \l__hook_labels_int
+         \seq_put_right:Nn \l__hook_labels_seq {##1}
+         \tl_set:cn { \__hook_tl_csname:n {##1} }{0}
+         \seq_clear_new:c { \__hook_seq_csname:n {##1} }
+       }
+    \prop_map_inline:Nn \l__hook_work_prop
       {
+        \prop_map_inline:Nn \l__hook_work_prop
+          {
+            \__hook_if_label_case:nnnnn {##1} {####1}
+              { \prop_map_break: }
+              { \__hook_apply_label_pair:nnn {##1} {####1} }
+              { \__hook_apply_label_pair:nnn {####1} {##1} }
+                  {#4}
+          }
+      }
+    \__hook_debug:n { \__hook_debug_label_data:N \l__hook_work_prop }
+    \tl_set:Nn \l__hook_rear_tl { 0 }
+    \tl_set:cn { \__hook_tl_csname:n { 0 } } { 0 }
+    \seq_map_inline:Nn \l__hook_labels_seq
+      {
         \int_compare:nNnT { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0
             {
               \tl_set:cn { \__hook_tl_csname:n { \l__hook_rear_tl } }{##1}
@@ -1427,42 +1490,41 @@
               \tl_set:Nn \l__hook_rear_tl {##1}
             }
       }
-  \tl_set_eq:Nc \l__hook_front_tl { \__hook_tl_csname:n { 0 } }
-  \tl_gclear:N #1
-  \clist_gclear:N #3
-  \bool_while_do:nn { ! \str_if_eq_p:Vn \l__hook_front_tl { 0 } }
-       {
-         \int_decr:N \l__hook_labels_int
-         \prop_get:NVN \l__hook_work_prop \l__hook_front_tl \l__hook_return_tl
-         \__hook_tl_gput:NV #1 \l__hook_return_tl
-         \__hook_clist_gput:NV #3 \l__hook_front_tl
-         \__hook_debug:n{ \iow_term:x{Handled~ code~ for~ \l__hook_front_tl} }
-         \seq_map_inline:cn { \__hook_seq_csname:n { \l__hook_front_tl } }
-             {
-               \tl_set:cx { \__hook_tl_csname:n {##1} }
-                          { \int_eval:n
-                              { \cs:w \__hook_tl_csname:n {##1} \cs_end: - 1 }
-                          }
-               \int_compare:nNnT
-                   { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0
-                   {
-                     \tl_set:cn { \__hook_tl_csname:n { \l__hook_rear_tl } } {##1}
-                     \tl_set:Nn \l__hook_rear_tl            {##1}
-                   }
-             }
-          \tl_set_eq:Nc \l__hook_front_tl
-                        { \__hook_tl_csname:n { \l__hook_front_tl } }
-       }
-  \int_compare:nNnF \l__hook_labels_int = 0
+    \tl_set_eq:Nc \l__hook_front_tl { \__hook_tl_csname:n { 0 } }
+    \tl_gclear:N #1
+    \clist_gclear:N #3
+    \bool_while_do:nn { ! \str_if_eq_p:Vn \l__hook_front_tl { 0 } }
       {
+        \int_decr:N \l__hook_labels_int
+        \prop_get:NVN \l__hook_work_prop \l__hook_front_tl \l__hook_return_tl
+        \__hook_tl_gput:NV #1 \l__hook_return_tl
+        \__hook_clist_gput:NV #3 \l__hook_front_tl
+        \__hook_debug:n{ \iow_term:x{Handled~ code~ for~ \l__hook_front_tl} }
+        \seq_map_inline:cn { \__hook_seq_csname:n { \l__hook_front_tl } }
+          {
+            \tl_set:cx { \__hook_tl_csname:n {##1} }
+                       { \int_eval:n
+                           { \cs:w \__hook_tl_csname:n {##1} \cs_end: - 1 }
+                       }
+            \int_compare:nNnT
+                { \cs:w \__hook_tl_csname:n {##1} \cs_end: } = 0
+                {
+                  \tl_set:cn { \__hook_tl_csname:n { \l__hook_rear_tl } } {##1}
+                  \tl_set:Nn \l__hook_rear_tl            {##1}
+                }
+          }
+        \tl_set_eq:Nc \l__hook_front_tl
+                      { \__hook_tl_csname:n { \l__hook_front_tl } }
+      }
+    \int_compare:nNnF \l__hook_labels_int = 0
+      {
         \iow_term:x{====================}
         \iow_term:x{Error:~ label~ rules~ are~ incompatible:}
         \__hook_debug_label_data:N \l__hook_work_prop
         \iow_term:x{====================}
       }
-  \tl_gput_right:Nn #1 {#2}
-  \debug_resume:
-}
+    \tl_gput_right:Nn #1 {#2}
+  }
 \cs_generate_variant:Nn \__hook_initialize_single:NNNn {ccc}
 \cs_new:Npn \__hook_tl_gput:NV     {\ERROR}
 \cs_new:Npn \__hook_clist_gput:NV  {\ERROR}
@@ -1566,67 +1628,88 @@
 }
 \cs_new_protected:Npn \hook_log:n #1
   {
-    \exp_args:Nx \__hook_log:n
-      { \__hook_parse_label_default:nn {#1} { top-level } }
+    \cs_set_eq:NN \__hook_log_cmd:x \iow_log:x
+    \__hook_normalize_hook_args:Nn \__hook_log:nN {#1} \tl_log:x
   }
-\cs_new_protected:Npn \__hook_log:n #1
+\cs_new_protected:Npn \hook_show:n #1
   {
+    \cs_set_eq:NN \__hook_log_cmd:x \iow_term:x
+    \__hook_normalize_hook_args:Nn \__hook_log:nN {#1} \tl_show:x
+  }
+\cs_new_protected:Npn \__hook_log_line:x #1
+  { \__hook_log_cmd:x { >~#1 } }
+\cs_new_protected:Npn \__hook_log_line_indent:x #1
+  { \__hook_log_cmd:x { >~\@spaces #1 } }
+\cs_new_protected:Npn \__hook_log:nN #1 #2
+  {
     \__hook_preamble_hook:n {#1}
-    \iow_term:x{^^JThe~ hook~ '#1':}
+    \iow_term:x { ^^J ->~The~hook~'#1': }
     \hook_if_exist:nF {#1}
-      { \iow_term:x {~Hook~ is~ not~ declared!} }
+      { \__hook_log_line:x { is~not~declared! } }
     \__hook_if_exist:nTF {#1}
       {
-        \iow_term:x{~Code~ chunks:}
-        \prop_if_empty:cTF {g__hook_#1_code_prop}
-          { \iow_term:x{\@spaces ---} }
+        \__hook_log_line:x { Code~chunks: }
+        \prop_if_empty:cTF { g__hook_#1_code_prop }
+          { \__hook_log_line_indent:x { --- } }
           {
-            \prop_map_inline:cn {g__hook_#1_code_prop}
-              { \iow_term:x{\@spaces ##1~ ->~ \tl_to_str:n{##2} } }
+            \prop_map_inline:cn { g__hook_#1_code_prop }
+              { \__hook_log_line_indent:x { ##1~->~\tl_to_str:n {##2} } }
           }
-        \iow_term:x{~Extra~ code~ next~ invocation:}
-        \iow_term:x{\@spaces
-          \tl_if_empty:cTF { g__hook_#1_code_next_tl }
-             {---}
-             {->~  \exp_args:Nv
-                   \__hook_log_next_code:n {g__hook_#1_code_next_tl} } }
-        \iow_term:x { ~Rules: }
+        \__hook_log_line:x { Extra~code~for~next~invocation:}
+        \__hook_log_line_indent:x
+          {
+            \tl_if_empty:cTF { __hook_next~#1 }
+              { --- }
+              { ->~ \exp_args:Nv \__hook_log_next_code:n { __hook_next~#1 } }
+          }
+        \__hook_log_line:x { Rules: }
         \bool_set_true:N \l__hook_tmpa_bool
         \__hook_list_rules:nn {#1}
           {
             \bool_set_false:N \l__hook_tmpa_bool
-            \iow_term:x
+            \__hook_log_line_indent:x
               {
-                \@spaces ##2~ with~
+                ##2~ with~
                 \str_if_eq:nnT {##3} {??} { default~ }
-                relation~ ##1 }
+                relation~ ##1
+              }
           }
         \bool_if:NT \l__hook_tmpa_bool
-          { \iow_term:x { \@spaces --- } }
-        \bool_lazy_and:nnT
+          { \__hook_log_line_indent:x { --- } }
+        \bool_lazy_and:nnTF
             { \hook_if_exist_p:n {#1} }
             { ! \hook_if_empty_p:n {#1} }
-          { \iow_term:x { ~Execution~ order
-               \bool_if:NTF \l__hook_tmpa_bool
-                 { \__hook_if_reversed:nT {#1}
-                        { ~ (after~ reversal) }
-                 }
-                 { ~ (after~
-                   \__hook_if_reversed:nT {#1} {reversal~ and~}
-                   applying~ rules)
-                 }
-               :
+          {
+            \__hook_log_line:x
+              {
+                Execution~order
+                \bool_if:NTF \l__hook_tmpa_bool
+                  { \__hook_if_reversed:nT {#1} { ~(after~reversal) } }
+                  { ~(after~
+                    \__hook_if_reversed:nT {#1} { reversal~and~ }
+                    applying~rules)
+                  } :
               }
-            \iow_term:x
-              { \@spaces \clist_use:cn {g__hook_#1_labels_clist} { ,~ } }
+            #2 % \tl_show:n
+              {
+                \@spaces
+                \clist_if_empty:cTF { g__hook_#1_labels_clist }
+                  { --- }
+                  { \clist_use:cn {g__hook_#1_labels_clist} { ,~ } }
+              }
           }
+          {
+            #2
+              {
+                Hook~ \hook_if_exist:nTF {#1}
+                  {code~pool~empty} {not~declared}
+              }
+          }
       }
-      { \iow_term:n { ~The~hook~is~empty. } }
-    \iow_term:n { }
+      { #2 { The~hook~is~empty. } }
   }
-\cs_new:Npn \__hook_log_next_code:n #1 {
-  \exp_args:No \tl_to_str:n {\use_none:nn #1}
-}
+\cs_new:Npn \__hook_log_next_code:n #1
+  { \exp_args:No \tl_to_str:n { \use_none:nn #1 } }
 \cs_new_protected:Npn \__hook_list_rules:nn #1 #2
   {
     \cs_set_protected:Npn \__hook_tmp:w ##1 ##2 ##3 {#2}
@@ -1671,47 +1754,56 @@
     \exp_args:No \__hook_tmp:w { \use:nn { ~ } { ~ } }
   }
 \cs_new_protected:Npn \hook_gput_next_code:nn #1
-  {
-    \exp_args:Nx \__hook_gput_next_code:nn
-      { \__hook_parse_label_default:nn {#1} { top-level } }
-  }
+  { \__hook_normalize_hook_args:Nn \__hook_gput_next_code:nn {#1} }
 \cs_new_protected:Npn \__hook_gput_next_code:nn #1 #2
   {
+    \debug_suspend:
     \__hook_declare:n {#1}
     \hook_if_exist:nTF {#1}
       { \__hook_gput_next_do:nn {#1} {#2} }
       { \__hook_try_declaring_generic_next_hook:nn {#1} {#2} }
+    \debug_resume:
   }
 \cs_new_protected:Npn \__hook_gput_next_do:nn #1
   {
     \exp_args:Nc \__hook_gput_next_do:Nnn
-      { g__hook_#1_code_next_tl } {#1}
+      { __hook_next~#1 } {#1}
   }
 \cs_new_protected:Npn \__hook_gput_next_do:Nnn #1 #2
   {
-    \tl_if_empty:cT { g__hook_#2_code_tl }
+    \tl_if_empty:cT { __hook~#2 }
       { \__hook_update_hook_code:n {#2} }
     \tl_if_empty:NT #1
-      { \tl_gset:Nn #1 { \tl_gclear:c { g__hook_#2_code_next_tl } } }
+      { \tl_gset:Nn #1 { \__hook_clear_next:n {#2} } }
     \tl_gput_right:Nn #1
   }
+\cs_new_protected:Npn \__hook_clear_next:n #1
+  { \cs_gset_eq:cN { __hook_next~#1 } \c_empty_tl }
 \cs_new_protected:Npn \hook_use:n #1
   {
-    \tl_if_exist:cTF { g__hook_#1_code_tl }
+    \tl_if_exist:cTF { __hook~#1 }
       {
         \__hook_preamble_hook:n {#1}
-        \cs:w g__hook_#1_code_tl \cs_end:
+        \cs:w __hook~#1 \cs_end:
       }
       { \__hook_use:wn #1 / \s__hook_mark {#1} }
   }
 \cs_new:Npn \__hook_use_initialized:n #1
   {
-    \tl_if_exist:cTF { g__hook_#1_code_tl }
-      { \cs:w g__hook_#1_code_tl \cs_end: }
-      { \__hook_use:wn #1 / \s__hook_mark {#1} }
+    \if_cs_exist:w __hook~#1 \cs_end:
+    \else:
+      \__hook_use_undefined:w
+    \fi:
+    \cs:w __hook~#1 \__hook_use_end:
   }
+\cs_new:Npn \__hook_use_undefined:w #1 #2 __hook~#3 \__hook_use_end:
+  {
+    #1 % fi
+    \__hook_use:wn #3 / \s__hook_mark {#3}
+  }
 \cs_new_protected:Npn \__hook_preamble_hook:n #1
   { \__hook_initialize_hook_code:n {#1} }
+\cs_new_eq:NN \__hook_use_end: \cs_end:
 \cs_new:Npn \__hook_use:wn #1 / #2 \s__hook_mark #3
   {
     \str_if_eq:nnTF {#1} { file }
@@ -1729,20 +1821,24 @@
   }
 \cs_new_protected:Npn \__hook_if_exist_use:n #1
   {
-    \tl_if_exist:cT { g__hook_#1_code_tl }
+    \tl_if_exist:cT { __hook~#1 }
       {
         \__hook_preamble_hook:n {#1}
-        \cs:w g__hook_#1_code_tl \cs_end:
+        \cs:w __hook~#1 \cs_end:
       }
   }
 \cs_new_protected:Npn \hook_use_once:n #1
   {
-    \tl_if_exist:cT { g__hook_#1_code_tl }
+    \tl_if_exist:cT { __hook~#1 }
       {
-        \clist_gput_left:Nn \g__hook_execute_immediately_clist {#1}
+        \tl_set:Nn \l__hook_return_tl {#1}
+        \__hook_normalize_hook_args:Nn \__hook_use_once_store:n
+          { \l__hook_return_tl }
         \hook_use:n {#1}
       }
   }
+\cs_new_protected:Npn \__hook_use_once_store:n #1
+  { \prop_gput:Nnn \g__hook_execute_immediately_prop {#1} { } }
 \prg_new_conditional:Npnn \hook_if_empty:n #1 { p , T , F , TF }
   {
     \__hook_if_exist:nTF {#1}
@@ -1749,7 +1845,7 @@
       {
         \bool_lazy_and:nnTF
             { \prop_if_empty_p:c { g__hook_#1_code_prop } }
-            { \tl_if_empty_p:c { g__hook_#1_code_next_tl } }
+            { \tl_if_empty_p:c { __hook_next~#1 } }
           { \prg_return_true: }
           { \prg_return_false: }
       }
@@ -1757,7 +1853,7 @@
   }
 \prg_new_conditional:Npnn \hook_if_exist:n #1 { p , T , F , TF }
   {
-    \tl_if_exist:cTF { g__hook_#1_code_tl }
+    \tl_if_exist:cTF { __hook~#1 }
       { \prg_return_true: }
       { \prg_return_false: }
   }
@@ -1775,7 +1871,6 @@
       \prg_return_false:
     \fi:
   }
-\clist_new:N \g__hook_execute_immediately_clist
 \msg_new:nnnn { hooks } { labels-incompatible }
   {
     Labels~`#1'~and~`#2'~are~incompatible
@@ -1817,11 +1912,7 @@
 \NewDocumentCommand \NewReversedHook     { m }{ \hook_new_reversed:n {#1} }
 \NewDocumentCommand \NewMirroredHookPair { mm }{ \hook_new_pair:nn {#1}{#2} }
 \NewDocumentCommand \AddToHook { m o +m }
-  {
-    \clist_if_in:NnTF \g__hook_execute_immediately_clist {#1}
-      {#3}
-      { \hook_gput_code:nnn {#1} {#2} {#3} }
-  }
+  { \hook_gput_code:nnn {#1} {#2} {#3} }
 \NewDocumentCommand \AddToHookNext { m +m }
   { \hook_gput_next_code:nn {#1} {#2} }
 \NewDocumentCommand \RemoveFromHook { m o }
@@ -1847,9 +1938,10 @@
     \seq_gpop:NN \g__hook_name_stack_seq \l__hook_return_tl
     \__hook_curr_name_push:n {#1}
   }
-\newcommand \UseHook        { \hook_use:n }
-\newcommand \UseOneTimeHook { \hook_use_once:n }
-\cs_new_protected:Npn \ShowHook { \hook_log:n }
+\cs_new:Npn \UseHook        { \hook_use:n }
+\cs_new:Npn \UseOneTimeHook { \hook_use_once:n }
+\cs_new_protected:Npn \ShowHook { \hook_show:n }
+\cs_new_protected:Npn \LogHook { \hook_log:n }
 \cs_new_protected:Npn \DebugHooksOn  { \hook_debug_on:  }
 \cs_new_protected:Npn \DebugHooksOff { \hook_debug_off: }
 \NewDocumentCommand \DeclareHookRule { m m m m }
@@ -3018,7 +3110,7 @@
 
 \edef \@kernel at after@begindocument at before {%
   \let\expandafter\noexpand\csname
-       g__hook_env/document/begin_code_tl\endcsname
+       __hook env/document/begin\endcsname
   \noexpand\@empty}
 \let \@kernel at before@begindocument \@empty
 \let \@kernel at after@begindocument \@empty
@@ -3956,7 +4048,7 @@
 %%
 %% File: ltfilehook.dtx (C) Copyright 2020 Frank Mittelbach,
 %%                                         Phelype Oleinik & LaTeX Team
-%%% From File: ltshipout.dtx
+%%% From File: ltfilehook.dtx
 \providecommand\ltfilehookversion{v1.0a}
 \providecommand\ltfilehookdate{2020/08/30}
 \IncludeInRelease{2020/10/01}%
@@ -4305,8 +4397,8 @@
 %% File: ltshipout.dtx (C) Copyright 2020 Frank Mittelbach, LaTeX Team
 %%
 %%% From File: ltshipout.dtx
-\providecommand\ltshipoutversion{v1.0a}
-\providecommand\ltshipoutdate{2020/08/31}
+\providecommand\ltshipoutversion{v1.0b}
+\providecommand\ltshipoutdate{2020/09/09}
 \IncludeInRelease{2020/10/01}%
                  {\shipout}{Hook mangement (shipout)}%
 \ExplSyntaxOn
@@ -4554,7 +4646,8 @@
     \vbox_to_zero:n {
       \kern -\c__shipout_vorigin_tl \scan_stop:
       \unitlength 1pt \scan_stop:
-      \hbox_set_to_wd:Nnn \l__shipout_tmp_box \c_zero_dim { \ignorespaces #1 }
+      \hbox_set_to_wd:Nnn \l__shipout_tmp_box \c_zero_dim
+                          { \ignorespaces #1 \hss }
       \box_set_ht:Nn \l__shipout_tmp_box \c_zero_dim
       \box_set_dp:Nn \l__shipout_tmp_box \c_zero_dim
       \box_use:N \l__shipout_tmp_box
@@ -5625,6 +5718,23 @@
 \let\protected at wlog\@undefined
 
 \EndIncludeInRelease
+\IncludeInRelease{2020/10/01}{\@pass at ptions}
+  {Add file replacement in \@pass at ptions}%
+\def\@pass at ptions#1#2#3{%
+  \edef\reserved at a{\@expl@@@filehook at resolve@file at subst@@w #3.#1\@nil}%
+  \expandafter\xdef\csname opt@\reserved at a\endcsname{%
+    \@ifundefined{opt@\reserved at a}\@empty
+      {\csname opt@\reserved at a\endcsname,}%
+    \zap at space#2 \@empty}}
+\EndIncludeInRelease
+\IncludeInRelease{0000/00/00}{\@pass at ptions}
+  {\@pass at ptions}%
+\def\@pass at ptions#1#2#3{%
+  \expandafter\xdef\csname opt@#3.#1\endcsname{%
+    \@ifundefined{opt@#3.#1}\@empty
+      {\csname opt@#3.#1\endcsname,}%
+    \zap at space#2 \@empty}}
+\EndIncludeInRelease
 \IncludeInRelease{2020/10/01}%
                  {\@process at pti@ns}{Unused options issue}%
 \def\@process at pti@ns{%
@@ -5781,6 +5891,13 @@
          {\@expl@@@filehook at file@push@@
           \set at curr@file{\@currname.\@currext}%
           \@filehook at set@CurrentFile
+          \edef\@currpkg at reqd{\@currname.\@currext}%
+          \ifx\CurrentFile\CurrentFileUsed
+          \else
+            \filename at parse\@curr at file
+            \edef\@currname{\string at makeletter\filename at base}%
+            \edef\@currext{\string at makeletter\filename at ext}%
+          \fi
           \load at onefile@withoptions{#2}%
           \@expl@@@filehook at file@pop@@}%
        \expandafter\@firstofone
@@ -5798,7 +5915,6 @@
     \@reset at ptions}
 \@onlypreamble\@onefilewithoptions
 \let\@unprocessedoptions\@undefined
-
 \def\@missing at onefilewithoptions#1{%
   \@missingfileerror\@currname\@currext
   \xdef\@currname{\@missingfile at area\@missingfile at base}%
@@ -5820,7 +5936,9 @@
         \UseHook{class/before/\@currname}%
       \fi
     \fi
-    \InputIfFileExists{\@currname.\@currext}{}{}%
+    \InputIfFileExists{\@currpkg at reqd}{}%
+      {\@latex at error
+        {The \@cls at pkg\space\@currpkg at reqd\space failed to load.}\@ehd}%
     \expandafter\let\csname unprocessedoptions-\@currname.\@currext\endcsname
                     \@@unprocessedoptions
     \csname\@currname.\@currext-h@@k\endcsname
@@ -5843,7 +5961,7 @@
         \UseHook{class/after}%
       \fi
     \fi}%
-  \reserved at a}
+  \@ifl at aded\@currext\@currname{}{\reserved at a}}
 \EndIncludeInRelease
 \IncludeInRelease{0000/00/00}%
       {\@onefilewithoptions}{Hooks and unused options issue}%
@@ -10264,6 +10382,8 @@
 \cs_gset_eq:NN \@expl at cs@prefix at spec@@N \cs_prefix_spec:N
 \cs_gset_eq:NN \@expl at cs@argument at spec@@N \cs_argument_spec:N
 \cs_gset_eq:NN \@expl at cs@replacement at spec@@N \cs_replacement_spec:N
+\cs_gset_eq:NN \@expl at str@map at function@@NN \str_map_function:NN
+\cs_gset_eq:NN \@expl at char@generate@@nn \char_generate:nn
 \EndIncludeInRelease
 \IncludeInRelease{0000/00/00}{expl3~2020-10-01}%
         {expl3~macros~added~for~the~2020-10-01~release}%
@@ -10272,6 +10392,7 @@
 \cs_undefine:N \@expl at cs@prefix at spec@@N
 \cs_undefine:N \@expl at cs@argument at spec@@N
 \cs_undefine:N \@expl at cs@replacement at spec@@N
+\cs_undefine:N \@expl at str@map at function@@NN
 \EndIncludeInRelease
 \ExplSyntaxOff
 %%% From File: ltfinal.dtx

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/srclfile-ltx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/srclfile-ltx.sty	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/srclfile-ltx.sty	2020-09-11 20:57:29 UTC (rev 56324)
@@ -44,7 +44,7 @@
 %%
 %% File: ltfilehook.dtx (C) Copyright 2020 Frank Mittelbach,
 %%                                         Phelype Oleinik & LaTeX Team
-%%% From File: ltshipout.dtx
+%%% From File: ltfilehook.dtx
 \providecommand\ltfilehookversion{v1.0a}
 \providecommand\ltfilehookdate{2020/08/30}
 \newcommand\BeforeClass[2]

Modified: trunk/Master/texmf-dist/tex/latex-dev/base/structuredlog.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex-dev/base/structuredlog.sty	2020-09-11 20:56:15 UTC (rev 56323)
+++ trunk/Master/texmf-dist/tex/latex-dev/base/structuredlog.sty	2020-09-11 20:57:29 UTC (rev 56324)
@@ -44,7 +44,7 @@
 %%
 %% File: ltfilehook.dtx (C) Copyright 2020 Frank Mittelbach,
 %%                                         Phelype Oleinik & LaTeX Team
-%%% From File: ltshipout.dtx
+%%% From File: ltfilehook.dtx
 \providecommand\ltfilehookversion{v1.0a}
 \providecommand\ltfilehookdate{2020/08/30}
 \ProvidesExplPackage
@@ -62,7 +62,7 @@
         ( LEVEL ~ \int_use:N \g__filehook_nesting_level_int \c_space_tl #1 ) ~
         \CurrentFileUsed
         \str_if_eq:NNF \CurrentFileUsed \CurrentFile
-          { ~ ( \CurrentFile \space requested ) }
+          { ~ ( \CurrentFile \c_space_tl requested ) }
         \iow_newline:
       }
     \str_if_eq:nnT {#1} {STOP} { \int_gdecr:N \g__filehook_nesting_level_int }



More information about the tex-live-commits mailing list.