[latex3-commits] [git/LaTeX3-latex3-latex2e] gh569: Copying environments is a lot simpler after 6ab19a4 (83dbfad4)

PhelypeOleinik phelype.oleinik at latex-project.org
Mon Aug 30 04:35:09 CEST 2021


Repository : https://github.com/latex3/latex2e
On branch  : gh569
Link       : https://github.com/latex3/latex2e/commit/83dbfad43c2e7719300cf4c5450bf7a4a9b86877

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

commit 83dbfad43c2e7719300cf4c5450bf7a4a9b86877
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date:   Sun Aug 29 23:35:09 2021 -0300

    Copying environments is a lot simpler after 6ab19a4


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

83dbfad43c2e7719300cf4c5450bf7a4a9b86877
 base/ltcmd.dtx | 59 +++++++++++-----------------------------------------------
 1 file changed, 11 insertions(+), 48 deletions(-)

diff --git a/base/ltcmd.dtx b/base/ltcmd.dtx
index fb0b5877..64a52b28 100644
--- a/base/ltcmd.dtx
+++ b/base/ltcmd.dtx
@@ -1965,8 +1965,8 @@
         \exp_not:N \@@_cmd_type_cases:NnnnnF \exp_not:N #2
           { \@@_copy_command:nnNN }
           { \@@_copy_expandable:nnNN }
-          { \@@_copy_env:nnNN }
-          { \@@_copy_env_end:nnNN }
+          { \@@_copy_environment:nnNN }
+          { \@@_copy_environment_end:nnNN }
           { \@@_cant_copy:nwn { non-ltcmd } }
             { \cs_to_str:N #1 } { \cs_to_str:N #2 }
             \exp_not:N #1 \exp_not:N #2
@@ -2198,54 +2198,17 @@
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}{\@@_copy_env:nnNN}
-% \begin{macro}{\@@_copy_env:Nnnnnnn}
+% \begin{macro}{\@@_copy_environment:nnNN}
+% \begin{macro}{\@@_copy_environment:Nnnnnnn}
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_copy_env:nnNN #1 #2 #3 #4
-  { \exp_after:wN \@@_copy_env:Nnnnnnn #4 {#1} }
-\cs_new_protected:Npn \@@_copy_env:Nnnnnnn #1 #2 #3 #4 #5 #6 #7
+\cs_new_protected:Npn \@@_copy_environment:nnNN #1 #2 #3 #4
   {
-    \@@_set_eq_if_exist:cc { #7 ~ defaults } { #3 ~ defaults }
-    \cs_set_protected_nopar:cpn { environment~ #7 }
-      { #1 {#2} {#7} {#4} {#5} {#6} }
-    \@@_split_signature:n {#2}
-    \cs_generate_from_arg_count:cNnn { environment~ #7 ~ code }
-      \cs_set_protected:Npx { \l_@@_current_arg_int - 1 }
-        {
-          \cs_set_nopar:Npx \exp_not:c { environment~ #7 ~end~aux }
-            {
-              \exp_not:N \exp_not:N
-              \exp_not:c { environment~ #7 ~end~aux~ }
-              \exp_not:n { \exp_not:o \l_@@_args_tl }
-            }
-          \exp_args:NNo \exp_args:No \exp_not:o
-            {
-              \exp_after:wN \exp_after:wN
-              \exp_after:wN \use_none:nnn
-              \cs:w environment~ #3 ~ code
-                \exp_after:wN \@@_make_parm_aux:w
-                \int_value:w \int_eval:n { \l_@@_current_arg_int - 1 } ;
-            }
-        }
-    \cs_set_eq:cc {#7}       { environment~ #7 }
-    \cs_set_eq:cc { end #7 } { environment~ #7 ~end }
-    % #1: \__cmd_start_env:nnnnn
-    % #2: {+b}
-    % #3: {foo} % old name
-    % #4: {\__cmd_grab_b_long:w }
-    % #5: {} % defaults
-    % #6: {} % processors
-    % #7: new name
-    % #8: new cs
-  }
-\cs_new:Npn \@@_make_parm_aux:w #1 ;
-  {
-    \int_compare:nNnTF {#1} = { 0 }
-      { \cs_end: }
-      {
-        \exp_after:wN \@@_make_parm_aux:w
-          \int_value:w \int_eval:n { #1 - 1 } ; { ## #1 }
-      }
+    \cs_set_eq:cc { environment~ #1 ~ code } { environment~ #2 ~ code }
+    \@@_set_eq_if_exist:cc
+      { environment~ #1 ~ defaults } { environment~ #2 ~ defaults }
+    \cs_set_protected_nopar:cpx { environment~ #1 }
+      { \exp_after:wN \@@_copy_environment:Nnnnnnn #4 {#1} }
+    \cs_set_eq:cc {#1} { environment~ #1 }
   }
 \cs_new_protected:Npn \@@_copy_env_end:nnNN #1 #2 #3 #4
   { \msg_error:nn { cmd } { env-copy } }





More information about the latex3-commits mailing list.