[latex3-commits] [git/LaTeX3-latex3-latex2e] gh22: Avoid spurious package option warning in certain situations (#22) (ab87b44b)
Frank Mittelbach
frank.mittelbach at latex-project.org
Tue Apr 7 15:45:25 CEST 2020
Repository : https://github.com/latex3/latex2e
On branch : gh22
Link : https://github.com/latex3/latex2e/commit/ab87b44b863189c5560464efab401b2a13953f18
>---------------------------------------------------------------
commit ab87b44b863189c5560464efab401b2a13953f18
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Tue Apr 7 15:45:25 2020 +0200
Avoid spurious package option warning in certain situations (#22)
>---------------------------------------------------------------
ab87b44b863189c5560464efab401b2a13953f18
base/changes.txt | 6 ++
base/doc/ltnews32.tex | 7 ++
base/ltclass.dtx | 75 +++++++++++++-
base/testfiles/github-0022.lvt | 25 +++++
base/testfiles/github-0022.tlg | 125 +++++++++++++++++++++++
base/testfiles/github-0022b.lvt | 31 ++++++
base/testfiles/{tlb0613.tlg => github-0022b.tlg} | 7 +-
base/testfiles/tlb-latexrelease-003.tlg | 8 ++
base/testfiles/tlb-rollback-004.luatex.tlg | 4 +
base/testfiles/tlb-rollback-004.tlg | 4 +
base/testfiles/tlb-rollback-004.xetex.tlg | 4 +
11 files changed, 292 insertions(+), 4 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index 40888a2a..ea96e3b1 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -1,3 +1,9 @@
+2020-04-07 Frank Mittelbach <Frank.Mittelbach at latex-project.org>
+
+ * ltclass.dtx (section{Implementation}):
+ Use different method to ignore unprocessed options (gh/22)
+
+
2020-04-06 Frank Mittelbach <Frank.Mittelbach at latex-project.org>
* ltfssini.dtx (section{Custom series settings for main document families}):
diff --git a/base/doc/ltnews32.tex b/base/doc/ltnews32.tex
index f90f6782..3eec5fd0 100644
--- a/base/doc/ltnews32.tex
+++ b/base/doc/ltnews32.tex
@@ -238,6 +238,13 @@ been corrected.
+\subsection{Avoid spurious package option warning}
+
+\emph{to write}
+%
+\githubissue{22}
+
+
\subsection{Adjusting \texttt{fleqn}}
In \pkg{amsmath} the \cs{mathindent} parameter used with the
diff --git a/base/ltclass.dtx b/base/ltclass.dtx
index f43e8f0c..485c0a92 100644
--- a/base/ltclass.dtx
+++ b/base/ltclass.dtx
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltclass.dtx}
- [2020/03/02 v1.3j LaTeX Kernel (Class & Package Interface)]
+ [2020/04/07 v1.3k LaTeX Kernel (Class & Package Interface)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltclass.dtx}
@@ -1050,6 +1050,10 @@
%
% The common part of |\ProcessOptions| and |\ProcessOptions*|.
% \begin{macrocode}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2020/10/01}%
+%<latexrelease> {\@process at pti@ns}{Drop unused options}%
\def\@process at pti@ns{%
\@for\CurrentOption:=\@curroptions\do{%
\@ifundefined{ds@\CurrentOption}%
@@ -1073,11 +1077,31 @@
% \end{macrocode}
% \changes{v1.0r}{1995/10/17}
% {Reset \cs{CurrentOption} for graphics/1873}
+% \changes{v1.3k}{2020/04/07}{Use different method to ignore
+% unprocessed options (gh/22)}
% \begin{macrocode}
\let\CurrentOption\@empty
\let\@fileswith at pti@ns\@@fileswith at pti@ns
- \AtEndOfPackage{\let\@unprocessedoptions\relax}}
+ \AtEndOfPackage{\@drop at unprocessoptions}}
\@onlypreamble\@process at pti@ns
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease> {\@process at pti@ns}{Drop unused options}%
+%<latexrelease>
+%<latexrelease>\def\@process at pti@ns{%
+%<latexrelease> \@for\CurrentOption:=\@curroptions\do{%
+%<latexrelease> \@ifundefined{ds@\CurrentOption}%
+%<latexrelease> {\@use at ption
+%<latexrelease> \default at ds}%
+%<latexrelease> \@use at ption}%
+%<latexrelease> \@for\CurrentOption:=\@declaredoptions\do{%
+%<latexrelease> \expandafter\let\csname ds@\CurrentOption\endcsname\relax}%
+%<latexrelease> \let\CurrentOption\@empty
+%<latexrelease> \let\@fileswith at pti@ns\@@fileswith at pti@ns
+%<latexrelease> \AtEndOfPackage{\let\@unprocessedoptions\relax}}
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1243,13 +1267,58 @@
% \changes{v1.0v}{1996/10/04}{Reset \cs{@unprocessedoptions} for /2269}
% Load package `|#1|' with the current option list.
% \begin{macrocode}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2020/10/01}%
+%<latexrelease> {\@dropunprocessedoptions}{Drop
+%<latexrelease> unprocessed option}%
\def\RequirePackageWithOptions{%
- \AtEndOfPackage{\let\@unprocessedoptions\relax}%
+% \end{macrocode}
+% The resetting of \cs{unprocessedoptions} needs to be the very
+% last action in \cs{AtEndOfPackage} and this is comething we can't
+% guarantee just by adding to the hook (this is
+% really a case for hook management and should be replaced
+% eventually) so for now we force it differently
+% \changes{v1.3k}{2020/04/07}{Use different method to ignore
+% unprocessed options (gh/22)}
+% \begin{macrocode}
+ \AtEndOfPackage{\@drop at unprocessoptions}%
\@loadwithoptions\@pkgextension\RequirePackage}
\@onlypreamble\RequirePackageWithOptions
% \end{macrocode}
% \end{macro}
%
+%
+% \begin{macro}{\@drop at unprocessoptions}
+% Kind of a longish \cs{expandafter}. We skip ahead the re-add what
+% we scanned but drop \cs{@unprocessedoptions}.
+% \changes{v1.3k}{2020/04/07}{Use different method to ignore
+% unprocessed options (gh/22)}
+% \begin{macrocode}
+\long\def\@drop at unprocessoptions#1\@undefined\@unprocessedoptions{#1\@undefined}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+% \end{macrocode}
+% \end{macro}
+
+
+
+% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease> {\@dropunprocessedoptions}{Drop
+%<latexrelease> unprocessed option}%
+%<latexrelease>
+%<latexrelease>\def\RequirePackageWithOptions{%
+%<latexrelease> \AtEndOfPackage{\let\@unprocessedoptions\relax}%
+%<latexrelease> \@loadwithoptions\@pkgextension\RequirePackage}
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
+% \end{macrocode}
+
+
+
+
+%
% \begin{macro}{\usepackage}
% To begin with, |\usepackage| produces an error. This is reset by
% |\documentclass|.
diff --git a/base/testfiles/github-0022.lvt b/base/testfiles/github-0022.lvt
new file mode 100644
index 00000000..6040f123
--- /dev/null
+++ b/base/testfiles/github-0022.lvt
@@ -0,0 +1,25 @@
+\documentclass{article}
+
+
+\begin{filecontents}[force]{\jobname.sty}
+\DeclareOption{TEST}{\typeout{*** TEST OPTION ***}}
+\ProcessOptions
+\AtEndOfPackage{%
+ \RequirePackage{alltt}} % some package without \ProcessOptions
+\end{filecontents}
+
+\input{test2e}
+
+\START
+
+\usepackage[TEST]{bezier} % empty package without \ProcessOptions
+
+\usepackage[TEST]{doc} % non-empty package without \ProcessOptions
+
+\usepackage[TEST]{\jobname}
+
+\begin{document}
+
+\typeout{success!}
+
+\END
diff --git a/base/testfiles/github-0022.tlg b/base/testfiles/github-0022.tlg
new file mode 100644
index 00000000..9ece90a0
--- /dev/null
+++ b/base/testfiles/github-0022.tlg
@@ -0,0 +1,125 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+(bezier.sty)
+! LaTeX Error: Unknown option `TEST' for package `bezier'.
+See the LaTeX manual or LaTeX Companion for explanation.
+Type H <return> for immediate help.
+ ...
+l. ...
+The option `TEST' was not declared in package `bezier', perhaps you
+misspelled its name. Try typing <return> to proceed.
+(doc.sty
+Package: doc ....-..-.. v... Standard LaTeX documentation package (FMi)
+\c at StandardModuleDepth=\count...
+\guard at level=\count...
+\MacrocodeTopsep=\skip...
+\MacroIndent=\dimen...
+\macro at cnt=\count...
+\MacroTopsep=\skip...
+\index at excludelist=\toks...
+(multicol.sty
+Package: multicol ....-..-.. v... multicolumn formatting (FMi)
+\c at tracingmulticols=\count...
+\mult at box=\box...
+\multicol at leftmargin=\dimen...
+\c at unbalance=\count...
+\c at collectmore=\count...
+\doublecol at number=\count...
+\multicoltolerance=\count...
+\multicolpretolerance=\count...
+\full at width=\dimen...
+\page at free=\dimen...
+\premulticols=\dimen...
+\postmulticols=\dimen...
+\multicolsep=\skip...
+\multicolbaselineskip=\skip...
+\partial at page=\box...
+\last at line=\box...
+\maxbalancingoverflow=\dimen...
+\mult at rightbox=\box...
+\mult at grightbox=\box...
+\mult at gfirstbox=\box...
+\mult at firstbox=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\@tempa=\box...
+\c at minrows=\count...
+\c at columnbadness=\count...
+\c at finalcolumnbadness=\count...
+\last at try=\dimen...
+\multicolovershoot=\dimen...
+\multicolundershoot=\dimen...
+\mult at nat@firstbox=\box...
+\colbreak at box=\box...
+\mc at col@check at num=\count...
+)
+\IndexMin=\dimen...
+\c at IndexColumns=\count...
+\GlossaryMin=\dimen...
+\c at GlossaryColumns=\count...
+\check at sum=\count...
+\bslash at cnt=\count...
+\wrong at table=\toks...
+\c at CodelineNo=\count...
+)
+! LaTeX Error: Unknown option `TEST' for package `doc'.
+See the LaTeX manual or LaTeX Companion for explanation.
+Type H <return> for immediate help.
+ ...
+l. ...
+The option `TEST' was not declared in package `doc', perhaps you
+misspelled its name. Try typing <return> to proceed.
+(github-0022.sty
+*** TEST OPTION ***
+) (alltt.sty
+Package: alltt ....-..-.. v... defines alltt environment
+) (github-0022.aux)
+LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line ....
+LaTeX Font Info: ... okay on input line ....
+LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line ....
+LaTeX Font Info: ... okay on input line ....
+LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line ....
+LaTeX Font Info: ... okay on input line ....
+LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line ....
+LaTeX Font Info: ... okay on input line ....
+LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line ....
+LaTeX Font Info: ... okay on input line ....
+LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line ....
+LaTeX Font Info: ... okay on input line ....
+LaTeX Font Info: Checking defaults for U/cmr/m/n on input line ....
+LaTeX Font Info: ... okay on input line ....
+success!
diff --git a/base/testfiles/github-0022b.lvt b/base/testfiles/github-0022b.lvt
new file mode 100644
index 00000000..5c8b2034
--- /dev/null
+++ b/base/testfiles/github-0022b.lvt
@@ -0,0 +1,31 @@
+\documentclass{article}
+
+
+\begin{filecontents}[force]{\jobname-1.sty}
+\DeclareOption{X}{\typeout{Package \jobname-1 with option X}}
+\ProcessOptions*
+
+%\AtEndOfPackage{
+\RequirePackage{\jobname-2}
+\end{filecontents}
+
+
+\begin{filecontents}[force]{\jobname-2.sty}
+
+\typeout{Do something}
+\RequirePackage{\jobname-1} % make sure test1 is loaded (no options)
+
+\end{filecontents}
+
+
+\input{test2e}
+
+\START
+
+\usepackage[X]{\jobname-1}
+
+\begin{document}
+
+\typeout{success!}
+
+\END
diff --git a/base/testfiles/tlb0613.tlg b/base/testfiles/github-0022b.tlg
similarity index 88%
copy from base/testfiles/tlb0613.tlg
copy to base/testfiles/github-0022b.tlg
index 730985ca..c70d7419 100644
--- a/base/testfiles/tlb0613.tlg
+++ b/base/testfiles/github-0022b.tlg
@@ -1,6 +1,10 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
-(tlb0613.aux)
+(github-0022b-1.sty
+Package github-0022b-1 with option X
+) (github-0022b-2.sty
+Do something
+) (github-0022b.aux)
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line ....
LaTeX Font Info: ... okay on input line ....
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line ....
@@ -15,3 +19,4 @@ LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line ....
LaTeX Font Info: ... okay on input line ....
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line ....
LaTeX Font Info: ... okay on input line ....
+success!
diff --git a/base/testfiles/tlb-latexrelease-003.tlg b/base/testfiles/tlb-latexrelease-003.tlg
index 62da6f17..c641f133 100644
--- a/base/testfiles/tlb-latexrelease-003.tlg
+++ b/base/testfiles/tlb-latexrelease-003.tlg
@@ -131,8 +131,12 @@ Skipping: [....-..-..] Spaces in option clash check on input line ....
Applying: [....-..-..] Spaces in option clash check on input line ....
Skipping: [....-..-..] Protection for package info on input line ....
Applying: [....-..-..] Protection for package info on input line ....
+Skipping: [....-..-..] Drop unused options on input line ....
+Applying: [....-..-..] Drop unused options on input line ....
Skipping: [....-..-..] Spaces in \ExecuteOptions on input line ....
Applying: [....-..-..] Spaces in \ExecuteOptions on input line ....
+Skipping: [....-..-..] Drop unprocessed option on input line ....
+Applying: [....-..-..] Drop unprocessed option on input line ....
Skipping: [....-..-..] ifx tests in \@fileswith at pti@ns on input line ....
Applying: [....-..-..] ifx tests in \@fileswith at pti@ns on input line ....
Skipping: [....-..-..] Spaces in file names + optional arg on input line ...
@@ -464,8 +468,12 @@ Applying: [....-..-..] Spaces in option clash check on input line ....
Already applied: [....-..-..] Spaces in option clash check on input line ...
Skipping: [....-..-..] Protection for package info on input line ....
Applying: [....-..-..] Protection for package info on input line ....
+Skipping: [....-..-..] Drop unused options on input line ....
+Applying: [....-..-..] Drop unused options on input line ....
Applying: [....-..-..] Spaces in \ExecuteOptions on input line ....
Already applied: [....-..-..] Spaces in \ExecuteOptions on input line ....
+Skipping: [....-..-..] Drop unprocessed option on input line ....
+Applying: [....-..-..] Drop unprocessed option on input line ....
Applying: [....-..-..] ifx tests in \@fileswith at pti@ns on input line ....
Already applied: [....-..-..] ifx tests in \@fileswith at pti@ns on input line ....
Applying: [....-..-..] Spaces in file names + optional arg on input line ...
diff --git a/base/testfiles/tlb-rollback-004.luatex.tlg b/base/testfiles/tlb-rollback-004.luatex.tlg
index dbb35983..b3d30b42 100644
--- a/base/testfiles/tlb-rollback-004.luatex.tlg
+++ b/base/testfiles/tlb-rollback-004.luatex.tlg
@@ -226,8 +226,12 @@ Applying: [....-..-..] Spaces in option clash check on input line ....
Already applied: [....-..-..] Spaces in option clash check on input line ...
Applying: [....-..-..] Protection for package info on input line ....
Already applied: [....-..-..] Protection for package info on input line ...
+Skipping: [....-..-..] Drop unused options on input line ....
+Applying: [....-..-..] Drop unused options on input line ....
Applying: [....-..-..] Spaces in \ExecuteOptions on input line ....
Already applied: [....-..-..] Spaces in \ExecuteOptions on input line ....
+Skipping: [....-..-..] Drop unprocessed option on input line ....
+Applying: [....-..-..] Drop unprocessed option on input line ....
Applying: [....-..-..] ifx tests in \@fileswith at pti@ns on input line ....
Already applied: [....-..-..] ifx tests in \@fileswith at pti@ns on input line ....
Applying: [....-..-..] Spaces in file names + optional arg on input line ...
diff --git a/base/testfiles/tlb-rollback-004.tlg b/base/testfiles/tlb-rollback-004.tlg
index 3a3046f7..92b55d20 100644
--- a/base/testfiles/tlb-rollback-004.tlg
+++ b/base/testfiles/tlb-rollback-004.tlg
@@ -224,8 +224,12 @@ Applying: [....-..-..] Spaces in option clash check on input line ....
Already applied: [....-..-..] Spaces in option clash check on input line ...
Applying: [....-..-..] Protection for package info on input line ....
Already applied: [....-..-..] Protection for package info on input line ...
+Skipping: [....-..-..] Drop unused options on input line ....
+Applying: [....-..-..] Drop unused options on input line ....
Applying: [....-..-..] Spaces in \ExecuteOptions on input line ....
Already applied: [....-..-..] Spaces in \ExecuteOptions on input line ....
+Skipping: [....-..-..] Drop unprocessed option on input line ....
+Applying: [....-..-..] Drop unprocessed option on input line ....
Applying: [....-..-..] ifx tests in \@fileswith at pti@ns on input line ....
Already applied: [....-..-..] ifx tests in \@fileswith at pti@ns on input line ....
Applying: [....-..-..] Spaces in file names + optional arg on input line ...
diff --git a/base/testfiles/tlb-rollback-004.xetex.tlg b/base/testfiles/tlb-rollback-004.xetex.tlg
index 997b57ea..dcd1716d 100644
--- a/base/testfiles/tlb-rollback-004.xetex.tlg
+++ b/base/testfiles/tlb-rollback-004.xetex.tlg
@@ -224,8 +224,12 @@ Applying: [....-..-..] Spaces in option clash check on input line ....
Already applied: [....-..-..] Spaces in option clash check on input line ...
Applying: [....-..-..] Protection for package info on input line ....
Already applied: [....-..-..] Protection for package info on input line ...
+Skipping: [....-..-..] Drop unused options on input line ....
+Applying: [....-..-..] Drop unused options on input line ....
Applying: [....-..-..] Spaces in \ExecuteOptions on input line ....
Already applied: [....-..-..] Spaces in \ExecuteOptions on input line ....
+Skipping: [....-..-..] Drop unprocessed option on input line ....
+Applying: [....-..-..] Drop unprocessed option on input line ....
Applying: [....-..-..] ifx tests in \@fileswith at pti@ns on input line ....
Already applied: [....-..-..] ifx tests in \@fileswith at pti@ns on input line ....
Applying: [....-..-..] Spaces in file names + optional arg on input line ...
More information about the latex3-commits
mailing list.