[latex3-commits] [latex3/latex3] main: Set \l_keys_key_str in .initial:n(fixes #1013) (ed957e972)

github at latex-project.org github at latex-project.org
Mon May 22 17:21:39 CEST 2023


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/ed957e9725786188af58ba494fbd80367344492b

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

commit ed957e9725786188af58ba494fbd80367344492b
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon May 22 16:19:54 2023 +0100

    Set \l_keys_key_str in .initial:n(fixes #1013)


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

ed957e9725786188af58ba494fbd80367344492b
 l3kernel/CHANGELOG.md            |  1 +
 l3kernel/l3keys.dtx              | 10 +++++++++-
 l3kernel/testfiles/m3keys001.lvt |  7 ++++++-
 l3kernel/testfiles/m3keys001.tlg |  3 +++
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 1bf7d5ddb..9be817f0a 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -27,6 +27,7 @@ this project uses date-based 'snapshot' version identifiers.
 - Filtering/grouping applied to meta keys (issue \#940)
 - Issue correct error message if `bool` key is set
   incorrectly using `.initial:n` (issue \#1013)
+- Set `\l_keys_key_str` in `.initial:n` (issue \#1013)
 - Handling of implicit chars in `\text_purify:n` (issue \#1208)
 
 ## [2023-05-15]
diff --git a/l3kernel/l3keys.dtx b/l3kernel/l3keys.dtx
index a7e8f9e40..07550656b 100644
--- a/l3kernel/l3keys.dtx
+++ b/l3kernel/l3keys.dtx
@@ -2063,6 +2063,8 @@
 %
 % \begin{macro}{\@@_initialise:n}
 %   A set up for initialisation: just run the code if it exists.
+%   We need to set the key string here, using the deprecated \texttt{tl}
+%   as a piece of scratch space.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_initialise:n #1
   {
@@ -2072,7 +2074,13 @@
       {
         \str_clear:N \l_@@_inherit_str
         \cs_if_exist:cT { \c_@@_code_root_str \l_keys_path_str }
-          { \@@_execute:nn \l_keys_path_str {#1} }
+          {
+            \exp_after:wN \@@_find_key_module:wNN
+              \l_keys_path_str \s_@@_stop
+                \l_keys_key_tl \l_keys_key_str
+            \tl_set_eq:NN \l_keys_key_tl \l_keys_key_str
+            \@@_execute:nn \l_keys_path_str {#1}
+          }
       }
   }
 %    \end{macrocode}
diff --git a/l3kernel/testfiles/m3keys001.lvt b/l3kernel/testfiles/m3keys001.lvt
index 5d44fa04d..b2b83c4b4 100644
--- a/l3kernel/testfiles/m3keys001.lvt
+++ b/l3kernel/testfiles/m3keys001.lvt
@@ -1,4 +1,4 @@
-% Copyright (C) 2009-2016,2018-2021 The LaTeX Project
+% Copyright (C) 2009-2016,2018-2021,2023 The LaTeX Project
 
 
 \documentclass{minimal}
@@ -164,6 +164,11 @@
         key-one = value ,
       }
     \tl_log:N \l_tmpa_tl
+    \keys_define:nn { module }
+      {
+        key-one .code:n  = \str_show:N \l_keys_key_str ,
+        key-one .initial:n = a
+      }
   }
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/l3kernel/testfiles/m3keys001.tlg b/l3kernel/testfiles/m3keys001.tlg
index a3fe2a3e9..05bd921de 100644
--- a/l3kernel/testfiles/m3keys001.tlg
+++ b/l3kernel/testfiles/m3keys001.tlg
@@ -41,6 +41,9 @@ Defining key module/key-one on line ...
 > \l_tmpa_tl=value.
 > \l_tmpa_tl=xyz.
 > \l_tmpa_tl=value.
+> \l_keys_key_str=key-one.
+<recently read> }
+l. ...  }
 ============================================================
 ============================================================
 TEST 4: .meta:n





More information about the latex3-commits mailing list.