[latex3-commits] [git/LaTeX3-latex3-latex3] main: Auto-generate legacy switch if needed by keys (195f85d5c)

Joseph Wright joseph.wright at morningstar2.co.uk
Sat Jan 15 10:09:36 CET 2022


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

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

commit 195f85d5c8df68ca32ac0c7d5559efa27f0fa63d
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sat Jan 15 09:09:36 2022 +0000

    Auto-generate legacy switch if needed by keys


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

195f85d5c8df68ca32ac0c7d5559efa27f0fa63d
 l3kernel/CHANGELOG.md |  4 ++++
 l3kernel/l3keys.dtx   | 10 +++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index a95741d24..aa54076d7 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -7,6 +7,10 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Changed
+- Auto-generate legacy switch if required in .legacy_set_if:n
+  key property
+
 ### Fixed
 - Correct creation of `.if` property
 
diff --git a/l3kernel/l3keys.dtx b/l3kernel/l3keys.dtx
index 2c78e97f1..54dc7bca6 100644
--- a/l3kernel/l3keys.dtx
+++ b/l3kernel/l3keys.dtx
@@ -358,7 +358,7 @@
 %   require a value at point-of-use unless a default is set.
 % \end{function}
 %
-% \begin{function}[updated = 2021-11-22]
+% \begin{function}[updated = 2022-01-15]
 %   {
 %     .legacy_if_set:n, .legacy_if_gset:n,
 %     .legacy_if_set_inverse:n, .legacy_if_gset_inverse:n
@@ -369,8 +369,7 @@
 %   Defines \meta{key} to set legacy \cs{if} \meta{switch} to \meta{value}
 %   (which must be either \enquote{\texttt{true}} or \enquote{\texttt{false}}).
 %   The \meta{switch} is the name of the switch \emph{without the leading
-%   \cs{if}}. Note that in contrast to \pkg{expl3} variables, the \meta{switch}
-%   will \emph{not} be created if it does not exist.
+%   \cs{if}}.
 %
 %   The \texttt{inverse} versions will set the \meta{switch} to the logical
 %   opposite of the \meta{value}.
@@ -2063,6 +2062,11 @@
           \l_keys_key_str
       }
     \@@_default_set:n { true }
+    \cs_if_exist:cF { if#1 }
+      {
+         \cs:w newif \exp_after:wN \cs_end:
+           \cs:w if#1 \cs_end:
+      }
   }
 %    \end{macrocode}
 % \end{macro}





More information about the latex3-commits mailing list.