summaryrefslogtreecommitdiff
path: root/macros/latex-dev/base/ltfilehook.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex-dev/base/ltfilehook.dtx')
-rw-r--r--macros/latex-dev/base/ltfilehook.dtx217
1 files changed, 16 insertions, 201 deletions
diff --git a/macros/latex-dev/base/ltfilehook.dtx b/macros/latex-dev/base/ltfilehook.dtx
index 26dba35165..ecb499f347 100644
--- a/macros/latex-dev/base/ltfilehook.dtx
+++ b/macros/latex-dev/base/ltfilehook.dtx
@@ -31,8 +31,8 @@
%%% From File: ltfilehook.dtx
%
% \begin{macrocode}
-\providecommand\ltfilehookversion{v1.0a}
-\providecommand\ltfilehookdate{2020/08/30}
+\providecommand\ltfilehookversion{v1.0c}
+\providecommand\ltfilehookdate{2020/10/18}
% \end{macrocode}
%
%<*driver>
@@ -840,7 +840,7 @@
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease> {\declare@file@substitution}{File substitution}%
\ExplSyntaxOn
-\cs_new_eq:NN \declare@file@substitution \@@_subst_add:nn
+\cs_new_eq:NN \declare@file@substitution \@@_subst_add:nn
\cs_new_eq:NN \undeclare@file@substitution \@@_subst_remove:n
\ExplSyntaxOff
%</2ekernel|latexrelease>
@@ -872,8 +872,8 @@
%
% \begin{macro}{\set@curr@file,\@curr@file,\@curr@file@reqd}
% Now we hook into \cs{set@curr@file} to resolve a possible file
-% substitution, and add \cs{@expl@@@filehook@set@curr@file@@N} at the end, after
-% \cs{@curr@file} is set.
+% substitution, and add \cs{@expl@@@filehook@set@curr@file@@nNN}
+% at the end, after \cs{@curr@file} is set.
%
% A file name is built using
% \cs{expandafter}\cs{string}\cs{csname}\meta{filename}\cs{endcsname}
@@ -987,24 +987,24 @@
.tex\else\string#1\fi}
% \end{macrocode}
%
-% Then we call \cs{@expl@@@filehook@set@curr@file@@N} once for \cs{@curr@file}
-% to set \cs[no-index]{CurrentFile(Path)Used} and once for
+% Then we call \cs{@expl@@@filehook@set@curr@file@@nNN} once for
+% \cs{@curr@file} to set \cs[no-index]{CurrentFile(Path)Used} and once for
% \cs{@curr@file@reqd} to set \cs[no-index]{CurrentFile(Path)}.
% Here too the slower route is only used if a substitution happened,
-% but here \cs{@expl@@@filehook@if@file@replaced@@TF} can't be used because the
-% flag is reset at the \cs{endgroup} above, so we check if
+% but here \cs{@expl@@@filehook@if@file@replaced@@TF} can't be used because
+% the flag is reset at the \cs{endgroup} above, so we check if
% \cs{@curr@file} and \cs{@curr@file@reqd} differ. This macro is
% issued separate from \cs{set@curr@file} because it changes
% \cs{CurrentFile}, and side-effects would quickly get out of control.
% \begin{macrocode}
\def\@filehook@set@CurrentFile{%
- \@expl@@@filehook@set@curr@file@@N{\@curr@file}%
+ \@expl@@@filehook@set@curr@file@@nNN{\@curr@file}%
\CurrentFileUsed\CurrentFilePathUsed
\ifx\@curr@file@reqd\@curr@file
\let\CurrentFile\CurrentFileUsed
\let\CurrentFilePath\CurrentFilePathUsed
\else
- \@expl@@@filehook@set@curr@file@@N{\@curr@file@reqd}%
+ \@expl@@@filehook@set@curr@file@@nNN{\@curr@file@reqd}%
\CurrentFile\CurrentFilePath
\fi}
%</2ekernel|latexrelease>
@@ -1016,8 +1016,7 @@
%
%
%
-% \begin{macro}{\@@_set_curr_file:N,
-% \@@_set_curr_file:nNN,
+% \begin{macro}{\@@_set_curr_file:nNN,
% \@@_set_curr_file_assign:nnnNN}
% When inputting a file, \cs{set@curr@file} does a file lookup
% (in \cs{input@path} and \cs{l_file_search_path_seq}) and returns the
@@ -1032,17 +1031,12 @@
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
-%<latexrelease> {@@_set_curr_file:N}{Set curr file}%
+%<latexrelease> {@@_set_curr_file:nNN}{Set curr file}%
\ExplSyntaxOn
%<@@=filehook>
-\cs_new_protected:Npn \@@_set_curr_file:N #1
- { \exp_args:NV \@@_set_curr_file:nNN #1 }
-% \end{macrocode}
-%
-% \begin{macrocode}
\cs_new_protected:Npn \@@_set_curr_file:nNN #1
{
- \@@_file_parse_full_name:nN {#1}
+ \exp_args:Nf \@@_file_parse_full_name:nN {#1}
\@@_set_curr_file_assign:nnnNN
}
\cs_new_protected:Npn \@@_set_curr_file_assign:nnnNN #1 #2 #3 #4 #5
@@ -1331,8 +1325,8 @@
% \end{macrocode}
%
% \begin{macrocode}
-\cs_new_eq:NN \@expl@@@filehook@set@curr@file@@N
- \__filehook_set_curr_file:N
+\cs_new_eq:NN \@expl@@@filehook@set@curr@file@@nNN
+ \__filehook_set_curr_file:nNN
% \end{macrocode}
%
% \begin{macrocode}
@@ -1348,7 +1342,6 @@
% \begin{macrocode}
\cs_new_eq:NN \@expl@@@filehook@if@file@replaced@@TF
\__filehook_if_file_replaced:TF
-
% \end{macrocode}
%
% \begin{macrocode}
@@ -1532,184 +1525,6 @@
% \end{macrocode}
%
%
-% \subsection{Package \pkg{filehook} emulation}
-%
-% This is a partial implementation of the \pkg{filehook}
-% interfaces. It is only meant for guidance in case that package
-% gets updated to use the hook management.
-%
-% Not implemented are:
-%\begin{verbatim}
-% \AtBeginOfFiles
-% \AtEndOfFiles
-% \AtBeginOfInputs
-% \AtEndOfInputs
-% \AtBeginOfInputFile
-% \AtEndOfInputFile
-%\end{verbatim}
-%
-% \begin{macrocode}
-%<*filehook-draft>
-% \end{macrocode}
-%
-% \begin{macrocode}
-\newcommand\AtBeginOfEveryFile [1]
- {\AddToHook{file/before}{#1}}
-\newcommand\AtEndOfEveryFile [1]
- {\AddToHook{file/after}{#1}}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\newcommand\AtBeginOfIncludes [1]
- {\AddToHook{include/before}{#1}}
-\newcommand\AtEndOfIncludes [1]
- {\AddToHook{include/end}{#1}}
-\newcommand\AfterIncludes [1]
- {\AddToHook{include/after}{#1}}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\newcommand\AtBeginOfPackages [1]
- {\AddToHook{package/before}{#1}}
-\newcommand\AtEndOfPackages [1]
- {\AddToHook{package/after}{#1}}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\newcommand\AtBeginOfClasses [1]
- {\AddToHook{class/before}{#1}}
-\newcommand\AtEndOfClasses [1]
- {\AddToHook{class/after}{#1}}
-% \end{macrocode}
-%
-% For normal files we drop the \texttt{.tex} extension for now:
-% \begin{macrocode}
-\newcommand\AtBeginOfFile [2]
- {\AddToHook{file/before/#1}{#2}}
-\newcommand\AtEndOfFile [2]
- {\AddToHook{file/after/#1}{#2}}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\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? I know they are use 3--4 times
-% on CTAN but I wonder if those are real or mistaken usages.
-% \begin{macrocode}
-\DeclareDocumentCommand \AtBeginOfClassFile {smm}
- {\IfBooleanTF{#1}%
- {\@ifclassloaded{#2}%
- {#3}%
- {\AddToHook{class/before/#2}{#3}}}%
- {\AddToHook{class/before/#2}{#3}}%
- }
-\DeclareDocumentCommand \AtEndOfClassFile {smm}
- {\IfBooleanTF{#1}%
- {\@ifclassloaded{#2}%
- {#3}%
- {\AddToHook{class/after/#2}{#3}}}%
- {\AddToHook{class/after/#2}{#3}}%
- }
-% \end{macrocode}
-%
-% \begin{macrocode}
-\newcommand\AtBeginOfIncludeFile [2]
- {\AddToHook{include/before/#1}{#2}}
-\newcommand\AtEndOfIncludeFile [2]
- {\AddToHook{include/end/#1}{#2}}
-\newcommand\AfterIncludeFile [2]
- {\AddToHook{include/after/#1}{#2}}
-% \end{macrocode}
-%
-%
-% This is missing some interfaces so disabling the package isn't
-% really correct, but then this code above is not supposed to stay
-% like this anyway.
-% \begin{macrocode}
-\expandafter\let\csname ver@filehook.sty\endcsname\fmtversion
-\@namedef {ver@filehook.sty}{2020/10/01}
-% \end{macrocode}
-%
-%
-% \begin{macrocode}
-%</filehook-draft>
-% \end{macrocode}
-%
-%
-%
-%
-% \subsection{Package \pkg{scrlfile} emulation}
-%
-% This is a partial implementation of the \pkg{scrlfile}
-% interfaces. It is only meant for guidance in case that package
-% gets updated to use the hook management.
-%
-% \begin{macrocode}
-%<*scrlfile-draft>
-% \end{macrocode}
-%
-% I think this is roughly correct (using the \texttt{file/...}
-% hooks rather than the class or package hooks at least for the
-% \cs{After...} commands but it needs some further verification.
-%
-% The star and plus variants haven't been implemented so far, this
-% is only a rough draft.
-% \begin{macrocode}
-\newcommand\BeforeClass[2]
- {\AddToHook{file/before/#1.cls}{#2}}
-\newcommand\AfterClass [2]
- {\AddToHook{file/after/#1.cls}{#2}}
-\newcommand\AfterAtEndOfClass [2]
- {\AddToHook{class/after/#1}{#2}}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\newcommand\BeforePackage [2]
- {\AddToHook{package/before/#1.sty}{#2}}
-\newcommand\AfterPackage [2]
- {\AddToHook{file/after/#1.sty}{#2}}
-\newcommand\AfterEndOfPackage [2]
- {\AddToHook{package/after/#1}{#2}}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\newcommand\BeforeFile [2]
- {%
- \typeout{BeforeFile: #1!!!}%
- \AddToHook{file/before/#1}{#2}}
-\newcommand\AfterFile [2]
- {%
- \typeout{AfterFile: #1!!!}%
- \AddToHook{file/after/#1}{#2}}
-% \end{macrocode}
-%
-% This is missing some interfaces so disabling the package isn't
-% really correct, but then this code above is not supposed to stay
-% like this anyway.
-% \begin{macrocode}
-\expandafter\let\csname ver@scrlfile.sty\endcsname\fmtversion
-\@namedef {ver@scrlfile.sty}{2020/10/01}
-% \end{macrocode}
-%
-% \begin{macrocode}
-%</scrlfile-draft>
-% \end{macrocode}
-%
-%
%
% \Finale
%