[latex3-commits] [git/LaTeX3-latex3-latex2e] lthooks2: start integrating ltfilehook temp move ltclass earlier provide atbegshi substitution (3f4e3c38)

Frank Mittelbach frank.mittelbach at latex-project.org
Mon Aug 17 15:34:29 CEST 2020


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

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

commit 3f4e3c38936b0b10d12e0a3d49363be4b1de0caa
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Mon Aug 17 15:34:29 2020 +0200

    start integrating ltfilehook
    temp move ltclass earlier
    provide atbegshi substitution


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

3f4e3c38936b0b10d12e0a3d49363be4b1de0caa
 base/format.ins                        |   4 +-
 base/ltfilehook.dtx                    |  18 +---
 base/ltfinal.dtx                       |   3 +-
 base/lthooks.ins                       |   3 +-
 base/ltshipout.dtx                     | 162 +++++++++++++++++++--------------
 base/testfiles-lthooks/shipout-000.tlg |   4 +
 base/testfiles-lthooks/shipout-002.lvt |   4 +-
 7 files changed, 110 insertions(+), 88 deletions(-)

diff --git a/base/format.ins b/base/format.ins
index a215c5d2..79069d26 100644
--- a/base/format.ins
+++ b/base/format.ins
@@ -199,9 +199,11 @@ the system are in the document `cfgguide.tex'.
           \from{ltidxglo.dtx}{2ekernel}
           \from{ltbibl.dtx}{2ekernel}
           \from{ltpage.dtx}{2ekernel}
+         \from{ltclass.dtx}{2ekernel,tracerollback}
+          \from{ltfilehook.dtx}{2ekernel}     % L3 layer module
           \from{ltshipout.dtx}{2ekernel}        % L3 layer module
           \from{ltoutput.dtx}{2ekernel}
-          \from{ltclass.dtx}{2ekernel,tracerollback}
+%          \from{ltclass.dtx}{2ekernel,tracerollback}
           \from{ltfinal.dtx}{2ekernel}}
    \file{tracefnt.sty}{%
           \from{ltfsstrc.dtx}{package,trace}}
diff --git a/base/ltfilehook.dtx b/base/ltfilehook.dtx
index aa66e705..02c22ab5 100644
--- a/base/ltfilehook.dtx
+++ b/base/ltfilehook.dtx
@@ -1409,23 +1409,6 @@
 %    kernel will not provide any.
 %
 %
-%    Only temp before integration
-%    \begin{macrocode}
-\disable at package@load{atenddvi}
-   {\PackageWarning{atenddvi}
-     {Functionality of this package is already\MessageBreak
-      provided by LaTeX.\MessageBreak\MessageBreak
-      It is there no longer necessary to load it\MessageBreak
-      and you can safely remove it.\MessageBreak
-      Found on}}
-%    \end{macrocode}
-%
-%    Only temp before integration
-%    \begin{macrocode}
-\declare at file@substitution{everyshi.sty}{everyshi-ltx.sty}
-%    \end{macrocode}
-%
-%
 %    \begin{macrocode}
 %</2ekernel>
 %    \end{macrocode}
@@ -1683,6 +1666,7 @@
 % \end{macro}
 %
 %    \begin{macrocode}
+%<@@=>
 %</structuredlog>
 %    \end{macrocode}
 
diff --git a/base/ltfinal.dtx b/base/ltfinal.dtx
index 8a5876e1..e4b6d994 100644
--- a/base/ltfinal.dtx
+++ b/base/ltfinal.dtx
@@ -1161,7 +1161,8 @@
 %    \begin{macrocode}
 
 
-\input ltfilehook.ltx
+%\input ltfilehook.ltx
+
 
 %</2ekernel|latexrelease>
 %<latexrelease>\EndIncludeInRelease
diff --git a/base/lthooks.ins b/base/lthooks.ins
index fcb7b4ce..b925d8f4 100644
--- a/base/lthooks.ins
+++ b/base/lthooks.ins
@@ -66,6 +66,7 @@ where one can also log issues in case there are any.
 
 
 \generate{\file{everyshi-ltx.sty}{\from{ltshipout.dtx}{everyshi-ltx}}} % emulating everyshi
+\generate{\file{atbegshi-ltx.sty}{\from{ltshipout.dtx}{atbegshi-ltx}}} % emulating atbegshi
 
 
 
@@ -73,8 +74,8 @@ where one can also log issues in case there are any.
 
 \generate{\file{lthooks.sty}{\from{lthooks.dtx}{package}}}
 
-\generate{\file{filehook-ltx.sty}{\from{ltfilehook.dtx}{filehook-draft}}}
 
+\generate{\file{filehook-ltx.sty}{\from{ltfilehook.dtx}{filehook-draft}}}
 \generate{\file{srclfile-ltx.sty}{\from{ltfilehook.dtx}{scrlfile-draft}}}
 
 \endbatchfile
diff --git a/base/ltshipout.dtx b/base/ltshipout.dtx
index e7dc228d..f0c2f287 100644
--- a/base/ltshipout.dtx
+++ b/base/ltshipout.dtx
@@ -1305,120 +1305,145 @@
 
 
 % \section{Package emulation for compatibility}
+%
+%
+%
+%
+% \subsection{Package \pkg{atenddvi} emulation}
+%
+%
+%  \begin{macro}{\AtEndDvi}
+%    This package has only one public command to simulating it is easy
+%    and actually sensible to provide as part of the kernel.
+%    \begin{macrocode}
+\cs_new:Npn \AtEndDvi {\AddToHook{shipout/lastpage}}
+%    \end{macrocode}
+%  \end{macro}
+%
+%    \begin{macrocode}
+\ExplSyntaxOff
+%    \end{macrocode}
+%    
+%    As the package is integrate we prevent loading:
+%    \begin{macrocode}
+\disable at package@load{atenddvi}
+   {\PackageWarning{atenddvi}
+     {Functionality of this package is already\MessageBreak
+      provided by LaTeX.\MessageBreak\MessageBreak
+      It is there no longer necessary to load it\MessageBreak
+      and you can safely remove it.\MessageBreak
+      Found on}}
+%    \end{macrocode}
+%
+%
+%    \begin{macrocode}
+%</2ekernel>
+%    \end{macrocode}
+%
+%
+% \subsection{Package \pkg{atbegshi} emulation}
 
 
-% \subsection{Package \pkg{atbegshi} emulation}
 
+%    \begin{macrocode}
+%<*atbegshi-ltx>
+\ProvidesPackage{atbegshi}
+   [2020/08/17 v1.0a
+     Emulation of the original atbegshi package^^Jwith kernel methods]
+\ExplSyntaxOn   
+%    \end{macrocode}
+%
+%
 %  \begin{macro}{\AtBeginShipoutBox}
 %    \begin{macrocode}
-\cs_new_eq:NN \AtBeginShipoutBox \ShipoutBox
+\cs_set_eq:NN \AtBeginShipoutBox \ShipoutBox
 %    \end{macrocode}
 %  \end{macro}
-
-
-
+%
+%
 %  \begin{macro}{\AtBeginShipoutInit}
 %    Compatibility only, we aren't delaying \ldots
 %    \begin{macrocode}
-\cs_set_eq:NN\AtBeginShipoutInit\@empty 
+\cs_set_eq:NN \AtBeginShipoutInit \@empty 
 %    \end{macrocode}
 %  \end{macro}
-
-
-
+%
+%
 %  \begin{macro}{\AtBeginShipout,\AtBeginShipoutNext}
 %    Filling hooks
 %    \begin{macrocode}
-\newcommand\AtBeginShipout     {\AddToHook{shipout/before}}
-\newcommand\AtBeginShipoutNext {\AddToHookNext{shipout/before}}
+\cs_new:Npn \AtBeginShipout     {\AddToHook{shipout/before}}
+\cs_new:Npn \AtBeginShipoutNext {\AddToHookNext{shipout/before}}
 %    \end{macrocode}
 %  \end{macro}
-
-
-
+%
+%
 %  \begin{macro}{\AtBeginShipoutFirst}
 %    Slightly more complex as we need to know the name of the command under which the
 %    \hook{shipout/firstpage} hook is filled.
 %    \begin{macrocode}
-\newcommand\AtBeginShipoutFirst{\@@_add_firstpage_material:Nn \AtBeginShipoutFirst}
+\cs_new:Npn \AtBeginShipoutFirst
+   {\__shipout_firstpage_material:Nn \AtBeginShipoutFirst}
 %    \end{macrocode}
 %  \end{macro}
-
-
-
-% This is somewhat different from the original where
-% \cs{ShipoutBoxHeight} etc.\ only holds the \verb=\the\ht<box>= value. This
-% may has some implications in some use cases and if that is a problem
-%    then it might need changing.
 %
-%    \begin{macrocode}
-\cs_new:Npn \ShipoutBoxHeight { \dim_use:N \l_shipout_box_ht_dim }
-\cs_new:Npn \ShipoutBoxDepth  { \dim_use:N \l_shipout_box_dp_dim }
-\cs_new:Npn \ShipoutBoxWidth  { \dim_use:N \l_shipout_box_wd_dim }
-%    \end{macrocode}
-
-
+%
 %  \begin{macro}{\AtBeginShipoutDiscard}
 %    Just a different name.
 %    \begin{macrocode}
 \cs_new_eq:NN \AtBeginShipoutDiscard \DiscardShipoutBox
 %    \end{macrocode}
 %  \end{macro}
-
-
+%
+%
 %  \begin{macro}{\AtBeginShipoutAddToBox,\AtBeginShipoutAddToBoxForeground,
 %                \AtBeginShipoutUpperLeft,\AtBeginShipoutUpperLeftForeground}
 %    We don't expose them.
 %    \begin{macrocode}
-\cs_new_eq:NN \AtBeginShipoutAddToBox           \@@_add_background_box:n
-\cs_new_eq:NN \AtBeginShipoutAddToBoxForeground \@@_add_foreground_box:n 
+\cs_set_eq:NN \AtBeginShipoutAddToBox           \@@_add_background_box:n
+\cs_set_eq:NN \AtBeginShipoutAddToBoxForeground \@@_add_foreground_box:n 
 %    \end{macrocode}
 %    
 %    \begin{macrocode}
-\cs_new_eq:NN\AtBeginShipoutUpperLeft           \@@_add_background_picture:n
-\cs_new_eq:NN\AtBeginShipoutUpperLeftForeground \@@_add_foreground_picture:n
+\cs_set_eq:NN \AtBeginShipoutUpperLeft           \@@_add_background_picture:n
+\cs_set_eq:NN \AtBeginShipoutUpperLeftForeground \@@_add_foreground_picture:n
 %    \end{macrocode}
 %  \end{macro}
-
-%
-%
-%    We prevent the package \pkg{atbegshi} from loading:
-%    \begin{macrocode}
-\expandafter\cs_set_eq:NN\csname ver at atbegshi.sty\endcsname\fmtversion
-%    \end{macrocode}
-%    \pkg{hyperref} code (and \pkg{ltxcmds}) doesn't understand 2020-10-01
-%       and thinks it is before 1994, so for now \ldots
-%    \begin{macrocode}
-\@namedef {ver at atbegshi.sty}{2020/10/01}
-%    \end{macrocode}
 %
 %
 %
-% \subsection{Package \pkg{atenddvi} emulation}
-%
-%
-%  \begin{macro}{\AtEndDvi}
-%    This package has only one public command to simulating it is easy
-%    and actually sensible to provide as part of the kernel.
+%  \begin{macro}{\ShipoutBoxHeight,\ShipoutBoxWidth,\ShipoutoBoxDepth}
+%    This is somewhat different from the original in \pkg{atbegshi}
+%    where \cs{ShipoutBoxHeight} etc.\ only holds the
+%    \verb=\the\ht<box>= value. This may has some implications in some
+%    use cases and if that is a problem then it might need changing.
 %    \begin{macrocode}
-\cs_new:Npn \AtEndDvi {\AddToHook{shipout/lastpage}}
+\cs_new:Npn \ShipoutBoxHeight { \dim_use:N \l_shipout_box_ht_dim }
+\cs_new:Npn \ShipoutBoxDepth  { \dim_use:N \l_shipout_box_dp_dim }
+\cs_new:Npn \ShipoutBoxWidth  { \dim_use:N \l_shipout_box_wd_dim }
 %    \end{macrocode}
 %  \end{macro}
 %
+%    \begin{macrocode}
+\ExplSyntaxOff
+%    \end{macrocode}
 %    
 %    \begin{macrocode}
-%\disable at package@load{atenddvi}
-%   {\PackageWarning{atenddvi}{Functionality already provided by
-%          LaTeX.\Messagebreak
-%         Package is no longer necessary, you can safely remove it}}
+%</atbegshi-ltx>
 %    \end{macrocode}
 %
+%    If the package is requested we substitute the one above:
 %    \begin{macrocode}
-\ExplSyntaxOff
+%<*2ekernel>
+\declare at file@substitution{atbegshi.sty}{atbegshi-ltx.sty}
 %</2ekernel>
 %    \end{macrocode}
 %
 %
+%
+%
+%
+%
 % \subsection{Package \pkg{everyshi} emulation}
 %
 %  \begin{macro}{\EveryShipout,\AtNextShipout}
@@ -1431,8 +1456,12 @@
 %    \end{macrocode}
 %    
 %    \begin{macrocode}
-\let\EveryShipout\AtBeginShipout
-\let\AtNextShipout\AtBeginShipoutNext
+\def \EveryShipout  {\AddToHook{shipout/before}}
+\def \AtNextShipout {\AddToHookNext{shipout/before}}
+%    \end{macrocode}
+%  \end{macro}
+%
+%    \begin{macrocode}
 %    This is one difference between \pkg{everyshi} and the kernel
 %    implementation, the latter does not directly use box 255.
 %
@@ -1456,22 +1485,21 @@
 %%
 %</everyshi-ltx>
 %    \end{macrocode}
-%    
 %  \end{macro}
 %
+%
+%    If the package is requested we substitute the one above:
 %    \begin{macrocode}
 %<*2ekernel>
+\declare at file@substitution{everyshi.sty}{everyshi-ltx.sty}
+%</2ekernel>
 %    \end{macrocode}
-
-%    \begin{macrocode}
-%\declare at file@substitution{everyshi.sty}{everyshi-ltx.sty}
-%    \end{macrocode}
+%
 %
 %
 %
 %    Rather important :-)
 %    \begin{macrocode}
-%</2ekernel>
 %<@@=>
 %    \end{macrocode}
 %
diff --git a/base/testfiles-lthooks/shipout-000.tlg b/base/testfiles-lthooks/shipout-000.tlg
index bfbef442..fd6aa9a8 100644
--- a/base/testfiles-lthooks/shipout-000.tlg
+++ b/base/testfiles-lthooks/shipout-000.tlg
@@ -1,2 +1,6 @@
 This is a generated file for the l3build validation system.
 Don't change this file in any respect.
+(atbegshi-ltx.sty
+Package: atbegshi ....-..-.. v... Emulation of the original atbegshi package
+with kernel methods
+)
diff --git a/base/testfiles-lthooks/shipout-002.lvt b/base/testfiles-lthooks/shipout-002.lvt
index 6cb96245..395677d1 100644
--- a/base/testfiles-lthooks/shipout-002.lvt
+++ b/base/testfiles-lthooks/shipout-002.lvt
@@ -1,4 +1,4 @@
-% testing atbegshi inclusion
+% testing atbegshi emulation
 
 \RequirePackage[enable-debug]{expl3}
 \ExplSyntaxOn
@@ -9,6 +9,8 @@
 
 \input{regression-test}
 
+\usepackage{atbegshi}
+
 \DebugShipoutsOn
 
 \AddToHook{shipout/lastpage}{\typeout{Something in lastpage}}  % force temp page





More information about the latex3-commits mailing list.