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

Conversation

josephwright
Copy link
Member

No description provided.

@josephwright josephwright force-pushed the load-global branch 2 times, most recently from 663dce7 to c4d2f3c Compare January 4, 2025 08:33
@josephwright
Copy link
Member Author

@davidcarlisle Ping

\begin{filecontents*}[overwrite]{testpackage.sty}
\ProvidesExplPackage{testpackage}{2025-02-04}{}{}
\keys_define:nn { testpackage }
{ testoption .code:n = { \def \testmacro { seen } } }
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't test the load-only code, and if I add testoption .usage=load then the duplicate load still produces a warning:


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

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks - fixed

% \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?

@u-fischer
Copy link
Member

If I test in this PR

\begin{filecontents*}[overwrite]{testpackage.sty}
\ProvidesExplPackage{testpackage}{2025-02-04}{}{}
\keys_define:nn { testpackage }
  {
    testoption .code:n = { \def \testmacro { #1 } } ,
    testoption .usage:n = { load }
  }
\ProcessKeyOptions [ testpackage ]
\endinput
\end{filecontents*}

\input{test2e}

\documentclass[testoption]{article}
\usepackage[testoption=false]{testpackage}
\usepackage[testoption=true]{testpackage}
\show\testmacro
\END 

Then I get no warning about an ignored load option. But with
\documentclass[testoption=false]{article} or \documentclass[testoption=true]{article}
I get two warnings (also in the current implementation).

@josephwright
Copy link
Member Author

OK, I'll think of a second generation plan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants