[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: Correct handling of unknown option list (see #938) (9bce4ab3)

GitHub noreply at github.com
Sat Oct 22 12:20:38 CEST 2022


Repository : https://github.com/latex3/latex2e
On branch  : develop
Link       : https://github.com/latex3/latex2e/commit/9bce4ab348ff46829e0e0ba5fb89e53a5d91bfa1

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

commit 9bce4ab348ff46829e0e0ba5fb89e53a5d91bfa1
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sat Oct 22 11:20:38 2022 +0100

    Correct handling of unknown option list (see #938)


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

9bce4ab348ff46829e0e0ba5fb89e53a5d91bfa1
 base/changes.txt                                       |  4 ++++
 base/doc/ltnews36.tex                                  |  7 +++++++
 base/ltkeys.dtx                                        | 12 +++++++-----
 base/testfiles/github-0892.tlg                         |  2 ++
 base/testfiles/github-0938.lvt                         | 11 +++++++++++
 base/testfiles/{tlb-ealloc-002.tlg => github-0938.tlg} |  4 +++-
 6 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index 6a91ae4e..f3d7198f 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,10 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 ================================================================================
 
+2022-10-22  Joseph Wright  <Joseph.Wright at latex-project.org>
+
+	* ltkeys.dtx: Correct handling of unknown option list
+
 2022-10-10  David Carlisle  <David.Carlisle at latex-project.org>
 
 	* ltclass.dtx: use \protected at edef rather than \edef when expanding option lists
diff --git a/base/doc/ltnews36.tex b/base/doc/ltnews36.tex
index fbb47d56..54e06f4e 100644
--- a/base/doc/ltnews36.tex
+++ b/base/doc/ltnews36.tex
@@ -392,6 +392,13 @@ approach altogether.
 %
 \githubissue{921}
 
+\subsection{Reporting of unused global issues when using key--value processing}
+
+Using the new key--value option processor did not properly report any unused
+global options when it was used in handling class options. This has now been
+corrected.
+%
+\githubissue{938}
 
 \section{Changes to packages in the \pkg{amsmath} category}
 
diff --git a/base/ltkeys.dtx b/base/ltkeys.dtx
index 88f9315f..b418aa35 100644
--- a/base/ltkeys.dtx
+++ b/base/ltkeys.dtx
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltkeys.dtx}
-             [2022/08/21 v1.0k LaTeX Kernel (Keyval options)]
+             [2022/10/22 v1.0l LaTeX Kernel (Keyval options)]
 % \iffalse
 \documentclass{l3doc}
 \GetFileInfo{ltkeys.dtx}
@@ -294,6 +294,7 @@
 % \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}
+% \changes{v1.0l}{2022/10/22}{Correct handling of unused option list}
 %   For classes, each option (stripped of any content after |=|)
 %   is checked for existence as a key. If found, the option is added to
 %   the combined list for processing. On the other hand, unused options
@@ -323,11 +324,12 @@
 \cs_new_protected:Npn \@@_options_class:nnn #1#2#3
   {
     \keys_if_exist:nnTF {#3} {#1}
-      { \clist_put_right:Nn \l_@@_options_clist {#2} }
       {
-        \str_if_eq:eeF
-          { \exp_not:v { @raw at opt@ \@currname . \@currext } }
-          { \exp_not:V \@raw at classoptionslist }
+        \clist_put_right:Nn \l_@@_options_clist {#2}
+        \clist_remove_all:Nn \@unusedoptionlist {#1}
+      }
+      {
+        \clist_if_in:NnF \@unusedoptionlist {#1}
           { \clist_put_right:Nn \@unusedoptionlist {#1} }
       }
   }
diff --git a/base/testfiles/github-0892.tlg b/base/testfiles/github-0892.tlg
index 298f0ea5..14c1cc47 100644
--- a/base/testfiles/github-0892.tlg
+++ b/base/testfiles/github-0892.tlg
@@ -36,6 +36,8 @@ LaTeX has been asked to set an option called 'option5' but the package
 "l3keys2e-package" has not created an option with this name.
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
+LaTeX Warning: Unused global option(s):
+    [option3].
 (github-0892.aux)
 LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line ....
 LaTeX Font Info:    ... okay on input line ....
diff --git a/base/testfiles/github-0938.lvt b/base/testfiles/github-0938.lvt
new file mode 100644
index 00000000..a60a6f5e
--- /dev/null
+++ b/base/testfiles/github-0938.lvt
@@ -0,0 +1,11 @@
+\input{test2e}
+\begin{filecontents}[overwrite]{myclass.cls}
+\ProvidesClass{myclass}[9999/12/31]
+\LoadClass{minimal}
+\DeclareKeys{foo .store = \myclassfoo,foo .default:n = {},baz .store=\myclassbaz}
+\ProcessKeyOptions
+\end{filecontents}
+\documentclass[foo,bar,baz=foo,ggg=\sqrt{4}]{myclass}
+\START
+\begin{document}
+\END
\ No newline at end of file
diff --git a/base/testfiles/tlb-ealloc-002.tlg b/base/testfiles/github-0938.tlg
similarity index 92%
copy from base/testfiles/tlb-ealloc-002.tlg
copy to base/testfiles/github-0938.tlg
index 67dd6b68..8badc522 100644
--- a/base/testfiles/tlb-ealloc-002.tlg
+++ b/base/testfiles/github-0938.tlg
@@ -1,6 +1,8 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
-(tlb-ealloc-002.aux)
+LaTeX Warning: Unused global option(s):
+    [bar,ggg].
+(github-0938.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 ....





More information about the latex3-commits mailing list.