[latex3-commits] [latex3/latex2e] gh1183: Add options to unused list when unknown key is active (fbf012c6)

github at latex-project.org github at latex-project.org
Mon Nov 20 19:51:27 CET 2023


Repository : https://github.com/latex3/latex2e
On branch  : gh1183
Link       : https://github.com/latex3/latex2e/commit/fbf012c6c9bf28dc6a05d84c8482fd25eaeb9786

>---------------------------------------------------------------

commit fbf012c6c9bf28dc6a05d84c8482fd25eaeb9786
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Nov 20 11:13:33 2023 +0000

    Add options to unused list when unknown key is active


>---------------------------------------------------------------

fbf012c6c9bf28dc6a05d84c8482fd25eaeb9786
 base/changes.txt               |  4 ++++
 base/ltkeys.dtx                | 27 +++++++++++++--------------
 base/testfiles/github-1183.lvt | 28 ++++++++++++++++++++++++++++
 base/testfiles/github-1183.tlg | 17 +++++++++++++++++
 4 files changed, 62 insertions(+), 14 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index c1024ea9..05ce2dce 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.
 ================================================================================
 
+2023-11-20  Joseph Wright  <Joseph.Wright at latex-project.org>
+	* ltkeys.dtx:
+	Correct addition to unused option list with unknown key property (gh/1183)
+
 2023-11-16  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 	* ltpara.dtx (subsection{Providing hooks for paragraphs}):
 	Correct error message: hook left horizontal not vertical mode (gh/1182)
diff --git a/base/ltkeys.dtx b/base/ltkeys.dtx
index 80c36d5c..6c3c3998 100644
--- a/base/ltkeys.dtx
+++ b/base/ltkeys.dtx
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltkeys.dtx}
-             [2022/10/22 v1.0l LaTeX Kernel (Keyval options)]
+             [2023/11/20 v1.0m LaTeX Kernel (Keyval options)]
 % \iffalse
 \documentclass{l3doc}
 \GetFileInfo{ltkeys.dtx}
@@ -294,6 +294,8 @@
 % \changes{v1.0g}{2022/06/16}{Better handling of option removal}
 % \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}{2023/11/20}
+%   {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}
@@ -309,18 +311,11 @@
   {
     \cs_if_free:cF { @raw at opt@ \@currname . \@currext }
       {
-        \keys_if_exist:nnTF {#1} { unknown }
+        \clist_map_inline:cn { @raw at opt@ \@currname . \@currext }
           {
-            \clist_put_right:Nv \l_@@_options_clist
-              { @raw at opt@ \@currname . \@currext }
-          }
-          {
-            \clist_map_inline:cn { @raw at opt@ \@currname . \@currext }
-              {
-                \exp_args:Ne \@@_options_class:nnn
-                  { \@@_remove_equals:n {##1} }
-                  {##1} {#1}
-              }
+            \exp_args:Ne \@@_options_class:nnn
+              { \@@_remove_equals:n {##1} }
+              {##1} {#1}
           }
       }
   }
@@ -332,8 +327,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}
diff --git a/base/testfiles/github-1183.lvt b/base/testfiles/github-1183.lvt
new file mode 100644
index 00000000..37941f55
--- /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 00000000..af264c89
--- /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 ....





More information about the latex3-commits mailing list.