Skip to content

Commit

Permalink
Add options to unused list when unknown key is active
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Jun 3, 2024
1 parent 8206f78 commit ec5c318
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 6 deletions.
4 changes: 4 additions & 0 deletions base/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ to completeness or accuracy and it contains some references to files that are
not part of the distribution.
================================================================================

2024-06-03 Joseph Wright <Joseph.Wright@latex-project.org>
* ltkeys.dtx:
Correct addition to unused option list with unknown key property (gh/1183)

================================================================================
All changes above are only part of the development branch for the next release.
================================================================================
Expand Down
19 changes: 13 additions & 6 deletions base/ltkeys.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltkeys.dtx}
[2024/01/13 v1.0m LaTeX Kernel (Keyval options)]
[2024/06/03 v1.0n LaTeX Kernel (Keyval options)]
% \iffalse
\documentclass{l3doc}
\GetFileInfo{ltkeys.dtx}
Expand Down Expand Up @@ -295,6 +295,8 @@
% \changes{v1.0h}{2022/06/19}{Further work on handling of option removal}
% \changes{v1.0h}{2022/06/20}{Use raw options data}
% \changes{v1.0m}{2024/01/13}{Trim spaces off key names}
% \changes{v1.0n}{2024/06/03}
% {Correct unused option tracking where unknown keys are allowed}
% \begin{macro}{\@@_options_class:nnn}
% \changes{v1.0h}{2022/06/20}{New function}
% \changes{v1.0i}{2022/07/05}{Correct naming of raw class options storage}
Expand All @@ -310,10 +312,11 @@
{
\cs_if_free:cF { @raw@opt@ \@currname . \@currext }
{
\keys_if_exist:nnTF {#1} { unknown }
\clist_map_inline:cn { @raw@opt@ \@currname . \@currext }
{
\clist_put_right:Nv \l_@@_options_clist
{ @raw@opt@ \@currname . \@currext }
\exp_args:Ne \@@_options_class:nnn
{ \@@_remove_equals:n {##1} }
{##1} {#1}
}
{
\clist_map_inline:cn { @raw@opt@ \@currname . \@currext }
Expand All @@ -333,8 +336,12 @@
\clist_remove_all:Nn \@unusedoptionlist {#1}
}
{
\clist_if_in:NnF \@unusedoptionlist {#1}
{ \clist_put_right:Nn \@unusedoptionlist {#1} }
\keys_if_exist:nnTF {#3} { unknown }
{ \clist_put_right:Nn \l_@@_options_clist {#2} }
{
\clist_if_in:NnF \@unusedoptionlist {#1}
{ \clist_put_right:Nn \@unusedoptionlist {#1} }
}
}
}
% \end{macrocode}
Expand Down
28 changes: 28 additions & 0 deletions base/testfiles/github-1183.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
\input{test2e}

\begin{filecontents}[overwrite]{github-1183.cls}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{github-1183}
\LoadClassWithOptions{article}

\DeclareKeys[testwork]{%
test .code = \newcommand{\foo}{#1},
test .usage = load,
% the following three lines give an equivalent definition of your bertha
% option as defined with `\DeclareOption{bertha}{}`
bertha .code = {},
bertha .value_forbidden:n = true,
bertha .usage = load,
% if you use this unknown handler, you get "test" and "bertha" as unknown
% options, if you omit it you get "a4paper" as unknown option
unknown .code = {}
}
\ProcessKeyOptions[testwork]

\endinput
\end{filecontents}
\documentclass[a4paper,test=wtf,bertha]{github-1183}

\START
\begin{document}
\END
17 changes: 17 additions & 0 deletions base/testfiles/github-1183.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
(github-1183.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 ....

0 comments on commit ec5c318

Please sign in to comment.