summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/filehook/filehook.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-08-19 20:57:51 +0000
committerKarl Berry <karl@freefriends.org>2019-08-19 20:57:51 +0000
commitb2ff7bb7e5f8e65740f50a0bc9d2621659187209 (patch)
tree971a927b9194bfe961b95ea29702c7dd9637e0dc /Master/texmf-dist/tex/latex/filehook/filehook.sty
parentaf57714cccb1f552e9a032cecb6ed26ac2192ce6 (diff)
filehook (19aug19)
git-svn-id: svn://tug.org/texlive/trunk@51910 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/filehook/filehook.sty')
-rw-r--r--Master/texmf-dist/tex/latex/filehook/filehook.sty52
1 files changed, 33 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/latex/filehook/filehook.sty b/Master/texmf-dist/tex/latex/filehook/filehook.sty
index 728462c2436..cf29c75c56b 100644
--- a/Master/texmf-dist/tex/latex/filehook/filehook.sty
+++ b/Master/texmf-dist/tex/latex/filehook/filehook.sty
@@ -1,27 +1,27 @@
-%% Copyright (c) 2010-2011 by Martin Scharrer <martin@scharrer-online.de>
-%% -----------------------------------------------------------------
-%%
+%% Copyright (C) 2011-2019 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
%% This work may be distributed and/or modified under the
-%% conditions of the LaTeX Project Public License, either version 1.3c
+%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
-%%
%% http://www.latex-project.org/lppl.txt
-%%
-%% and version 1.3c or later is part of all distributions of LaTeX
-%% version 2008/05/04 or later.
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Martin Scharrer.
%%
-%% This work consists of the files filehook.dtx, filehook.ins
-%% and the derived file filehook.sty.
+%% This work consists of the files filehook.dtx and filehook.ins
+%% and the derived files filehook.sty, filehook-fink.sty,
+%% filehook-listings.sty, filehook-memoir.sty, filehook-scrlfile.sty
+%% and pgf-filehook.sty
%%
-%% $Id: filehook.dtx 2504 2011-07-18 17:22:50Z martin $
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\ProvidesPackage{filehook}
- [2011/10/12 v0.5d Hooks for input files]
+\ProvidesPackage{filehook}[%
+ 2019/08/19
+ v0.5e
+ Hooks for input files]
\newif\iffilehook@force
\DeclareOption{force}{\filehook@forcetrue}
\ProcessOptions\relax
@@ -245,12 +245,22 @@
\expandafter\filehook@@ensuretex#1\empty.tex\empty\empty
}
\def\filehook@@ensuretex#1.tex\empty#2\empty{#1.tex}
-\long\def\latex@InputIfFileExists#1#2{%
+\long\def\oldlatex@InputIfFileExists#1#2{%
\IfFileExists{#1}%
{#2\@addtofilelist{#1}%
\@@input\@filef@und
}%
}
+\long\def\newlatex@InputIfFileExists#1#2{%
+ \IfFileExists{#1}%
+ {%
+ \expandafter\@swaptwoargs\expandafter
+ {\@filef@und}{#2\@addtofilelist{#1}\@@input}}}
+\@ifundefined{@swaptwoargs}{%
+ \let\latex@InputIfFileExists\oldlatex@InputIfFileExists
+}{%
+ \let\latex@InputIfFileExists\newlatex@InputIfFileExists
+}%
\long\gdef\filehook@default@InputIfFileExists#1#2{%
\IfFileExists{#1}%
{\expandafter\filehook@swap
@@ -369,8 +379,8 @@
}%
\ifcase
\ifx\InputIfFileExists\filehook@InputIfFileExists 0\else
- \ifx\InputIfFileExists\latex@InputIfFileExists 1\else
- \iffilehook@force 1\else
+ \ifx\InputIfFileExists\newlatex@InputIfFileExists 1\else
+ \ifx\InputIfFileExists\oldlatex@InputIfFileExists 1\else
9%
\fi\fi\fi
\relax% 0
@@ -378,13 +388,17 @@
\let\filehook@InputIfFileExists\filehook@default@InputIfFileExists
\let\filehook@@InputIfFileExists\filehook@@default@InputIfFileExists
\let\InputIfFileExists\filehook@InputIfFileExists
+\else
\iffilehook@force
+ \let\filehook@InputIfFileExists\filehook@default@InputIfFileExists
+ \let\filehook@@InputIfFileExists\filehook@@default@InputIfFileExists
+ \let\InputIfFileExists\filehook@InputIfFileExists
\PackageWarning{filehook}{Detected unknown definition of \string\InputIfFileExists.^^J%
The 'force' option of 'filehook' is in effect. Macro is overwritten with default!}%
+ \else
+ \PackageError{filehook}{Detected unknown definition of \string\InputIfFileExists.^^J%
+ Use the 'force' option of 'filehook' to overwrite it.}{}%
\fi
-\else
- \PackageError{filehook}{Detected unknown definition of \string\InputIfFileExists.^^J%
- Use the 'force' option of 'filehook' to overwrite it.}{}%
\fi
\AtBeginDocument{%
\ifx\InputIfFileExists\filehook@InputIfFileExists\else