[latex3-commits] [git/LaTeX3-latex3-latex3] options: Store key usage data as prop in all cases (4a8603c38)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Jan 10 18:19:26 CET 2022


Repository : https://github.com/latex3/latex3
On branch  : options
Link       : https://github.com/latex3/latex3/commit/4a8603c386f7fd8ac6372788748c723b4d957bb2

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

commit 4a8603c386f7fd8ac6372788748c723b4d957bb2
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Nov 29 22:51:34 2021 +0000

    Store key usage data as prop in all cases
    
    This means we already have the module name
    available: useful when we issue the messages in ltkeys.


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

4a8603c386f7fd8ac6372788748c723b4d957bb2
 l3kernel/l3keys.dtx | 47 ++++++++++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 21 deletions(-)

diff --git a/l3kernel/l3keys.dtx b/l3kernel/l3keys.dtx
index abf7776af..d2a294283 100644
--- a/l3kernel/l3keys.dtx
+++ b/l3kernel/l3keys.dtx
@@ -695,13 +695,13 @@
 %   should be one of \texttt{general}, \texttt{preamble} or \texttt{load}.
 % \end{function}
 %
-% \begin{variable}{\l_keys_usage_load_prop, \l_keys_usage_preamble_seq}
+% \begin{variable}[added = 2021-11-29]
+%   {\l_keys_usage_load_prop, \l_keys_usage_preamble_prop}
 %   \pkg{l3keys} itself does \emph{not} attempt to redefine keys based on the
 %   validity scope. Rather, this information is made available with these
-%   two variables. The property list holds an entry for each module (prefix).
-%   Each of these entries, and the sequence of preamble-only keys, comprise
-%   a set of fully-qualified key paths. This data can therefore
-%   be used to disable each key when it is out-of-scope. 
+%   two property lists. These hold an entry for each module (prefix); the
+%   value of each entry is a comma-separated list of the usage-restricted
+%   key(s).
 % \end{variable}
 %
 % \section{Setting keys}
@@ -1650,11 +1650,11 @@
 %    \end{macrocode}
 % \end{variable}
 %
-% \begin{variable}{\l_keys_usage_load_prop, \l_keys_usage_preamble_seq}
+% \begin{variable}{\l_keys_usage_load_prop, \l_keys_usage_preamble_prop}
 %   Global data for document-level information.
 %    \begin{macrocode}
 \prop_new:N \l_keys_usage_load_prop
-\seq_new:N \l_keys_usage_preamble_seq
+\seq_new:N \l_keys_usage_preamble_prop
 %    \end{macrocode}
 % \end{variable}
 %
@@ -2180,7 +2180,7 @@
 % \end{macro}
 %
 % \begin{macro}{\@@_usage:n}
-% \begin{macro}{\@@_validity_aux:n}
+% \begin{macro}{\@@_usage:NN}
 %   Save the relevant data.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_usage:n #1
@@ -2189,21 +2189,24 @@
       {
         { general }
           {
-            \@@_usage_aux:n
-              { \clist_remove:NV \l_@@_tmpa_tl \l_keys_path_str }
-            \seq_remove:NV \l_keys_usage_preamble_seq \l_keys_path_str
+            \@@_usage:NN \l_keys_usage_load_prop
+              \c_false_bool
+            \@@_usage:NN \l_keys_usage_preamble_prop
+              \c_false_bool
           }
         { load }
           {
-            \@@_usage_aux:n
-              { \clist_put_right:NV \l_@@_tmpa_tl \l_keys_path_str }
-            \seq_remove:NV \l_keys_usage_preamble_seq \l_keys_path_str
+            \@@_usage:NN \l_keys_usage_load_prop
+              \c_true_bool
+            \@@_usage:NN \l_keys_usage_preamble_prop
+              \c_false_bool
           }
         { preamble }
           {
-            \@@_usage_aux:n
-              { \clist_remove:NV \l_@@_tmpa_tl \l_keys_path_str }
-            \seq_put:NV \l_keys_usage_preamble_seq \l_keys_path_str
+            \@@_usage:NN \l_keys_usage_load_prop
+              \c_false_bool
+            \@@_usage:NN \l_keys_usage_preamble_prop
+              \c_true_bool
           }
       }
       {
@@ -2212,12 +2215,14 @@
           { .validity:n }
       }
   }
-\cs_new_protected:Npn \@@_usage_aux:n #1
+\cs_new_protected:Npn \@@_usage:NN #1#2
   {
-    \prop_get:NVNF \l_keys_usage_load_prop \l_@@_module_str
-      \l_@@_tmpa_tl
+    \prop_get:NVNF #1 \l_@@_module_str \l_@@_tmpa_tl
       { \tl_clear:N \l_@@_tmpa_tl }
-    \prop_put:NVV \l_keys_usage_load_prop \l_@@_module_str
+    \bool_if:NTF #2
+      { \clist_put_right:Nn \l_@@_tmpa_tl \l_keys_key_str }
+      { \clist_remove_all:Nn \l_@@_tmpa_tl \l_keys_key_str }
+    \prop_put:NVV #1 \l_@@_module_str
       \l_@@_tmpa_tl
   }
 %    \end{macrocode}





More information about the latex3-commits mailing list.