[latex3-commits] [git/LaTeX3-latex3-latex2e] lthooks: improved suggestion for filehook rewrite (93cffb2c)

Frank Mittelbach frank.mittelbach at latex-project.org
Mon Jul 13 19:40:56 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : lthooks
Link       : https://github.com/latex3/latex2e/commit/93cffb2c5976ac95924fd93a44203283e991e52a

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

commit 93cffb2c5976ac95924fd93a44203283e991e52a
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Mon Jul 13 19:40:56 2020 +0200

    improved suggestion for filehook rewrite


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

93cffb2c5976ac95924fd93a44203283e991e52a
 base/ltfilehook.dtx | 39 ++++++++++++++++++++++++++-------------
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/base/ltfilehook.dtx b/base/ltfilehook.dtx
index 9d241053..6dee9b67 100644
--- a/base/ltfilehook.dtx
+++ b/base/ltfilehook.dtx
@@ -17,8 +17,8 @@
 % for those people who are interested or want to report an issue.
 %
 %    \begin{macrocode}
-\providecommand\ltfilehookversion{v0.6b}
-\providecommand\ltfilehookdate{2020/07/09}
+\providecommand\ltfilehookversion{v0.6c}
+\providecommand\ltfilehookdate{2020/07/13}
 %    \end{macrocode}
 %
 %<*driver>
@@ -853,9 +853,9 @@
 %    \end{macrocode}
 %    
 %    \begin{macrocode}
-\newcommand\AtBeginOfClasss [1]
+\newcommand\AtBeginOfClasses [1]
   {\AddToHook{class/before}{#1}}
-\newcommand\AtEndOfClasss [1]
+\newcommand\AtEndOfClasses [1]
   {\AddToHook{class/after}{#1}}
 %    \end{macrocode}
 %
@@ -865,22 +865,35 @@
   {\drop at tex@extension{file/before/#1}%
     \expandafter\AddToHook\expandafter{\drop at tex@extension at result}{#2}}
 \newcommand\AtEndOfFile [2]
-  {\drop at tex@extension{file/after/#1}
+  {\drop at tex@extension{file/after/#1}%
    \expandafter\AddToHook\expandafter{\drop at tex@extension at result}{#2}}
 %    \end{macrocode}
 %    
 %    \begin{macrocode}
-\newcommand\AtBeginOfPackageFile [2]
-  {\AddToHook{package/before/#1}{#2}}
-\newcommand\AtEndOfPackageFile [2]
-  {\AddToHook{package/after/#1}{#2}}
+\DeclareDocumentCommand \AtBeginOfPackageFile {smm}
+   {\IfBooleanTF{#1}%
+     {\@ifpackageloaded{#2}{#3}%
+         {\AddToHook{package/before/#2}{#3}}}%
+     {\AddToHook{package/before/#2}{#3}}%
+   }
+\DeclareDocumentCommand \AtEndOfPackageFile {smm}
+   {\IfBooleanTF{#1}%
+     {\@ifpackageloaded{#2}{#3}%
+         {\AddToHook{package/after/#2}{#3}}}%
+     {\AddToHook{package/after/#2}{#3}}%
+   }
 %    \end{macrocode}
 %
+%    Are the * forms here of any use?   
 %    \begin{macrocode}
-\newcommand\AtBeginOfClassFile [2]
-  {\AddToHook{class/before/#1}{#2}}
-\newcommand\AtEndOfClassFile [2]
-  {\AddToHook{class/after/#1}{#2}}
+\DeclareDocumentCommand \AtBeginOfClassFile {smm}
+   {\IfBooleanTF{#1}%
+      {\NOTSUPPORTED}%
+      {\AddToHook{class/before/#2}{#3}}}
+\DeclareDocumentCommand \AtEndOfClassFile {smm}
+   {\IfBooleanTF{#1}%
+      {\NOTSUPPORTED}%
+      {\AddToHook{class/after/#2}{#3}}}
 %    \end{macrocode}
 %    
 %    \begin{macrocode}





More information about the latex3-commits mailing list.