Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress "load-only" warning for global options #1606

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
================================================================================

2025-01-12 Joseph Wright <Joseph.Wright@latex-project.org>
* ltclass.dtx
Suppress load-only warning for options given globally

2025-01-03 Frank Mittelbach <Frank.Mittelbach@latex-project.org>

* lthooks.dtx (subsubsection{Updating code for hooks}):
Expand Down
17 changes: 12 additions & 5 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/06/20 v1.0o LaTeX Kernel (Keyval options)]
[2025/01/12 v1.0p LaTeX Kernel (Keyval options)]
% \iffalse
\documentclass{l3doc}
\GetFileInfo{ltkeys.dtx}
Expand Down Expand Up @@ -576,20 +576,27 @@
% \begin{macro}{\@@_options_loaded:n}
% \begin{macro}{\@@_options_loaded:nn}
% \changes{v1.0l}{2022/10/20}{Correct an argument for a message}
% \changes{v1.0p}{2025-01-12}{Suppress load-only error for global options}
% Indicates that the load-time options for a package have been processed:
% once this has happened, make them unavailable either with a warning or
% an error.
% an error. We suppress the warning where the option is in the global list:
% there is a bit of gymnastics with the catcodes.
% \begin{macrocode}
\cs_new_protected:Npn \@@_options_loaded:n #1
{
\tl_set:Ne \l_@@_tmpb_tl { \tl_to_str:N \@classoptionslist }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using classoptionlist here rather than one of the versions that's been filtered to drop the values (eg for unused option warnings) seems a bit suspect. If I change the 1606 test file to have

\documentclass[testoption=?]{article}

Then the warning comes back for duplicate loads


LaTeX Warning: Package "testpackage" has already been loaded: ignoring
(LaTeX)        load-time option "testoption".

which doesn't seem quite right?

\prop_get:NnNT \l_keys_usage_load_prop {#1} \l_@@_tmpa_tl
{
\clist_map_inline:Nn \l_@@_tmpa_tl
{
\keys_define:nn {#1}
\clist_if_in:NnTF \l_@@_tmpb_tl {##1}
{ \keys_define:nn {#1} {##1 .code:n = } }
{
##1 .code:n =
\@@_options_loaded:nn {#1} {##1}
\keys_define:nn {#1}
{
##1 .code:n =
\@@_options_loaded:nn {#1} {##1}
}
}
}
}
Expand Down
21 changes: 21 additions & 0 deletions base/testfiles/github-1606.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
\begin{filecontents*}[overwrite]{testpackage.sty}
\ProvidesExplPackage{testpackage}{2025-02-04}{}{}
\keys_define:nn { testpackage }
{
testoption .code:n = { \def \testmacro { seen } } ,
testoption .usage:n = { load }
}
\ProcessKeyOptions [ testpackage ]
\endinput
\end{filecontents*}

\input{test2e}

\documentclass[testoption]{article}

\START

\usepackage{testpackage}
\usepackage{testpackage}

\END
5 changes: 5 additions & 0 deletions base/testfiles/github-1606.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
(testpackage.sty
Package: testpackage ....-..-..
)
Loading