Skip to content

Commit fbf012c

Browse files
committed
Add options to unused list when unknown key is active
1 parent 5064cfc commit fbf012c

File tree

4 files changed

+62
-14
lines changed

4 files changed

+62
-14
lines changed

base/changes.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ to completeness or accuracy and it contains some references to files that are
66
not part of the distribution.
77
================================================================================
88

9+
2023-11-20 Joseph Wright <[email protected]>
10+
* ltkeys.dtx:
11+
Correct addition to unused option list with unknown key property (gh/1183)
12+
913
2023-11-16 Frank Mittelbach <[email protected]>
1014
* ltpara.dtx (subsection{Providing hooks for paragraphs}):
1115
Correct error message: hook left horizontal not vertical mode (gh/1182)

base/ltkeys.dtx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
%<*driver>
3434
% \fi
3535
\ProvidesFile{ltkeys.dtx}
36-
[2022/10/22 v1.0l LaTeX Kernel (Keyval options)]
36+
[2023/11/20 v1.0m LaTeX Kernel (Keyval options)]
3737
% \iffalse
3838
\documentclass{l3doc}
3939
\GetFileInfo{ltkeys.dtx}
@@ -294,6 +294,8 @@
294294
% \changes{v1.0g}{2022/06/16}{Better handling of option removal}
295295
% \changes{v1.0h}{2022/06/19}{Further work on handling of option removal}
296296
% \changes{v1.0h}{2022/06/20}{Use raw options data}
297+
% \changes{v1.0m}{2023/11/20}
298+
% {Correct unused option tracking where unknown keys are allowed}
297299
% \begin{macro}{\@@_options_class:nnn}
298300
% \changes{v1.0h}{2022/06/20}{New function}
299301
% \changes{v1.0i}{2022/07/05}{Correct naming of raw class options storage}
@@ -309,18 +311,11 @@
309311
{
310312
\cs_if_free:cF { @raw@opt@ \@currname . \@currext }
311313
{
312-
\keys_if_exist:nnTF {#1} { unknown }
314+
\clist_map_inline:cn { @raw@opt@ \@currname . \@currext }
313315
{
314-
\clist_put_right:Nv \l_@@_options_clist
315-
{ @raw@opt@ \@currname . \@currext }
316-
}
317-
{
318-
\clist_map_inline:cn { @raw@opt@ \@currname . \@currext }
319-
{
320-
\exp_args:Ne \@@_options_class:nnn
321-
{ \@@_remove_equals:n {##1} }
322-
{##1} {#1}
323-
}
316+
\exp_args:Ne \@@_options_class:nnn
317+
{ \@@_remove_equals:n {##1} }
318+
{##1} {#1}
324319
}
325320
}
326321
}
@@ -332,8 +327,12 @@
332327
\clist_remove_all:Nn \@unusedoptionlist {#1}
333328
}
334329
{
335-
\clist_if_in:NnF \@unusedoptionlist {#1}
336-
{ \clist_put_right:Nn \@unusedoptionlist {#1} }
330+
\keys_if_exist:nnTF {#3} { unknown }
331+
{ \clist_put_right:Nn \l_@@_options_clist {#2} }
332+
{
333+
\clist_if_in:NnF \@unusedoptionlist {#1}
334+
{ \clist_put_right:Nn \@unusedoptionlist {#1} }
335+
}
337336
}
338337
}
339338
% \end{macrocode}

base/testfiles/github-1183.lvt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
\input{test2e}
2+
3+
\begin{filecontents}[overwrite]{github-1183.cls}
4+
\NeedsTeXFormat{LaTeX2e}
5+
\ProvidesClass{github-1183}
6+
\LoadClassWithOptions{article}
7+
8+
\DeclareKeys[testwork]{%
9+
test .code = \newcommand{\foo}{#1},
10+
test .usage = load,
11+
% the following three lines give an equivalent definition of your bertha
12+
% option as defined with `\DeclareOption{bertha}{}`
13+
bertha .code = {},
14+
bertha .value_forbidden:n = true,
15+
bertha .usage = load,
16+
% if you use this unknown handler, you get "test" and "bertha" as unknown
17+
% options, if you omit it you get "a4paper" as unknown option
18+
unknown .code = {}
19+
}
20+
\ProcessKeyOptions[testwork]
21+
22+
\endinput
23+
\end{filecontents}
24+
\documentclass[a4paper,test=wtf,bertha]{github-1183}
25+
26+
\START
27+
\begin{document}
28+
\END

base/testfiles/github-1183.tlg

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
This is a generated file for the LaTeX2e validation system.
2+
Don't change this file in any respect.
3+
(github-1183.aux)
4+
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line ....
5+
LaTeX Font Info: ... okay on input line ....
6+
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line ....
7+
LaTeX Font Info: ... okay on input line ....
8+
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line ....
9+
LaTeX Font Info: ... okay on input line ....
10+
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line ....
11+
LaTeX Font Info: ... okay on input line ....
12+
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line ....
13+
LaTeX Font Info: ... okay on input line ....
14+
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line ....
15+
LaTeX Font Info: ... okay on input line ....
16+
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line ....
17+
LaTeX Font Info: ... okay on input line ....

0 commit comments

Comments
 (0)