Skip to content

Commit

Permalink
Merge pull request #937 from latex3/keyval-tuneup
Browse files Browse the repository at this point in the history
Keyval tuneup
  • Loading branch information
josephwright committed Oct 23, 2022
2 parents 393f938 + 223b27d commit eb9a772
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
6 changes: 6 additions & 0 deletions base/changes.txt
Expand Up @@ -16,6 +16,12 @@ are not part of the distribution.

* ltkeys.dtx: Correct handling of unknown option list

2022-10-20 Joseph Wright <Joseph.Wright@latex-project.org>

* ltclass.dtx, ltkeys.dtx:
Correct an argument for a message
Define key option handler in ltkeys

2022-10-10 David Carlisle <David.Carlisle@latex-project.org>

* ltclass.dtx: use \protected@edef rather than \edef when expanding option lists
Expand Down
8 changes: 4 additions & 4 deletions base/ltclass.dtx
Expand Up @@ -2186,13 +2186,15 @@
% \end{macrocode}
% \changes{v1.5b}{2022/03/18}{Switch to \cs{ProcessKeyOptions}}
% \changes{v1.5c}{2022/06/20}{Pass raw options to \cs{ProcessKeyOptions}}
% \changes{v1.5e}{2022/10/20}
% {Define key option handler in \pkg{ltkeys}}
% In the current preferred approach, a key family name will exist for
% processing using \pkg{ltkeys}. In that case, we replace the previous
% package options with the new ones, then call the key handler.
% Otherwise, we use the more classical clash handler.
% \begin{macrocode}
{%
\@ifundefined{opt@fam@\@currname.\@currext}
\@ifundefined{opt@handler@\@currname.\@currext}
{\@onefilewithoptions@clashchk{#2}}
{%
% \end{macrocode}
Expand All @@ -2201,9 +2203,7 @@
\expandafter\protected@edef\csname opt@\@currname.\@currext\endcsname
{\zap@space#2 \@empty}%
\@namedef{@raw@opt@\@currname.\@currext}{#2}%
\expandafter\expandafter\expandafter\ProcessKeyOptions
\expandafter\expandafter\expandafter
[\csname opt@fam@\@currname.\@currext\endcsname]%
\@nameuse{opt@handler@\@currname.\@currext}%
}%
}%
{\makeatletter
Expand Down
14 changes: 8 additions & 6 deletions base/ltkeys.dtx
Expand Up @@ -209,6 +209,8 @@
% \begin{macro}{\@@_options_aux:n}
% \changes{v1.0b}{2022/01/15}
% {Clear option list in end-of-package hook}
% \changes{v1.0l}{2022/10/20}
% {Define key option handler in \pkg{ltkeys}}
% \changes{v1.0i}{2022/07/05}{Support \cs{CurrentOption}}
% \begin{macro}{\@@_options_end:}
% The main function calls functions to collect up the global and local
Expand All @@ -225,7 +227,8 @@
{ \@@_options_expand_module:Nn \@@_options_aux:n {#1} }
\cs_new_protected:Npn \@@_options_aux:n #1
{
\cs_gset_nopar:cpn { opt@fam@\@currname.\@currext } {#1}
\cs_gset_protected:cpn { opt@handler@\@currname.\@currext }
{ \ProcessKeyOptions [ #1 ] }
\cs_set_protected:Npn \@@_option_end: { }
\clist_clear:N \l_@@_options_clist
\@@_options_global:n {#1}
Expand Down Expand Up @@ -477,6 +480,7 @@
%
% \begin{macro}{\@@_options_loaded:n}
% \begin{macro}{\@@_options_loaded:nn}
% \changes{v1.0l}{2022/10/20}{Correct an argument for a message}
% 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.
Expand All @@ -498,11 +502,9 @@
\cs_new_protected:Npn \@@_options_loaded:nn #1#2
{
\bool_if:NTF \l_@@_options_loading_bool
{
\msg_warning:nnxx { keys } { load-option-ignored }
{ \use:c { opt@fam@\@currname.\@currext } } {#2}
}
{ \msg_error:nnnn { keys } { load-only } {#1} {#2} }
{ \msg_warning:nnnn { keys } { load-option-ignored } }
{ \msg_error:nnnn { keys } { load-only } }
{#1} {#2}
}
% \end{macrocode}
% \changes{v1.0j}{2022/07/23}
Expand Down

0 comments on commit eb9a772

Please sign in to comment.