From 2d8c7925c0114cee20071be19d9450780f969322 Mon Sep 17 00:00:00 2001 From: Joseph Wright Date: Mon, 20 Nov 2023 11:13:33 +0000 Subject: [PATCH] Add options to unused list when unknown key is active --- base/changes.txt | 4 ++++ base/ltkeys.dtx | 8 +++++--- base/testfiles/github-1183.lvt | 28 ++++++++++++++++++++++++++++ base/testfiles/github-1183.tlg | 17 +++++++++++++++++ 4 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 base/testfiles/github-1183.lvt create mode 100644 base/testfiles/github-1183.tlg diff --git a/base/changes.txt b/base/changes.txt index 72ab325ff..4c025b3b3 100644 --- a/base/changes.txt +++ b/base/changes.txt @@ -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 + * ltkeys.dtx: + Correct addition to unused option list with unknown key property (gh/1183) + 2024-06-19 David Carlisle * fontdef.dtx: diff --git a/base/ltkeys.dtx b/base/ltkeys.dtx index a9e430206..e69853d25 100644 --- a/base/ltkeys.dtx +++ b/base/ltkeys.dtx @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltkeys.dtx} - [2024/06/20 v1.0o LaTeX Kernel (Keyval options)] + [2024/06/25 v1.0p LaTeX Kernel (Keyval options)] % \iffalse \documentclass{l3doc} \GetFileInfo{ltkeys.dtx} @@ -361,6 +361,8 @@ % \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/19}{Refactor function} +% \changes{v1.0p}{2024/06/25} +% {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} @@ -387,7 +389,7 @@ { \exp_args:Ne \@@_options_class:nnn { \tl_trim_spaces:e { \@@_remove_equals:n {##1} } } - {##1} {#1} + {##1} {#1} } } } @@ -400,7 +402,7 @@ } { \keys_if_exist:nnTF {#3} { unknown } - { \@@_options_class:nn {#1} {#2} } + { \clist_put_right:Nn \l_@@_options_clist {#2} } { \clist_if_in:NnF \@unusedoptionlist {#1} { \clist_put_right:Nn \@unusedoptionlist {#1} } diff --git a/base/testfiles/github-1183.lvt b/base/testfiles/github-1183.lvt new file mode 100644 index 000000000..37941f55b --- /dev/null +++ b/base/testfiles/github-1183.lvt @@ -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 \ No newline at end of file diff --git a/base/testfiles/github-1183.tlg b/base/testfiles/github-1183.tlg new file mode 100644 index 000000000..af264c89d --- /dev/null +++ b/base/testfiles/github-1183.tlg @@ -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 ....