[latex3-commits] [git/LaTeX3-latex3-latex2e] gh963: Only check the \begin part, as \newenvironment does (44480154)
PhelypeOleinik
phelype.oleinik at latex-project.org
Mon Nov 28 05:09:32 CET 2022
Repository : https://github.com/latex3/latex2e
On branch : gh963
Link : https://github.com/latex3/latex2e/commit/44480154ad7fb018f587dc651c174c81b5044f13
>---------------------------------------------------------------
commit 44480154ad7fb018f587dc651c174c81b5044f13
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Mon Nov 28 01:09:32 2022 -0300
Only check the \begin part, as \newenvironment does
>---------------------------------------------------------------
44480154ad7fb018f587dc651c174c81b5044f13
base/ltdefns.dtx | 43 +++++++++++++++++++++++++------------------
1 file changed, 25 insertions(+), 18 deletions(-)
diff --git a/base/ltdefns.dtx b/base/ltdefns.dtx
index e8a4932b..c91f6c08 100644
--- a/base/ltdefns.dtx
+++ b/base/ltdefns.dtx
@@ -1643,6 +1643,7 @@
% \end{macrocode}
%
% \begin{macro}{\declare at commandcopy}
+% \begin{macro}{\declare at commandcopy@do}
% Start by checking if the command is already defined. The proper action is
% taken by each specific command above. If all's good, then
% \cs{robust at command@act} is called with the proper arguments as described
@@ -1652,11 +1653,14 @@
\long\def\declare at commandcopy#1#2#3#4{%
\edef\reserved at a{\@expl at cs@to at str@@N#3}%
\@ifundefined\reserved at a{#1}{#2}%
- {\robust at command@act
- \@declarecommandcopylisthook#4%
- \declare at commandcopy@let{#3#4}}}
+ {\declare at commandcopy@do{#3}{#4}}}
+\long\def\declare at commandcopy@do#1#2{%
+ \robust at command@act
+ \@declarecommandcopylisthook#2%
+ \declare at commandcopy@let{#1#2}}
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\@declarecommandcopylisthook}
% The initial definition of \cs{@declarecommandcopylisthook} contains the
@@ -1715,21 +1719,24 @@
% \changes{v1.5s}{2022/11/24}{Add \cs{NewEnvironmentCopy},
% \cs{RenewEnvironmentCopy}, and \cs{DeclareEnvironmentCopy} (gh/963)}
% \begin{macrocode}
-\def\NewEnvironmentCopy#1#2{%
- \ExpandArgs{cc}\NewCommandCopy{#1}{#2}%
- \ExpandArgs{cc}\NewCommandCopy{end#1}{end#2}%
-}
-% \end{macrocode}
-%
-% \begin{macrocode}
-\def\RenewEnvironmentCopy#1#2{%
- \ExpandArgs{cc}\RenewCommandCopy{#1}{#2}%
- \ExpandArgs{cc}\RenewCommandCopy{end#1}{end#2}%
-}
-\def\DeclareEnvironmentCopy#1#2{%
- \ExpandArgs{cc}\DeclareCommandCopy{#1}{#2}%
- \ExpandArgs{cc}\DeclareCommandCopy{end#1}{end#2}%
-}
+\def\NewEnvironmentCopy{%
+ \declare at environmentcopy
+ {\@firstofone}%
+ {\@firstoftwo\@notdefinable}}
+\def\RenewEnvironmentCopy{%
+ \declare at environmentcopy
+ {\@latex at error{Environment \reserved at a\space undefined}\@ehc
+ \@firstofone}%
+ {\@firstofone}}
+\def\DeclareEnvironmentCopy{%
+ \declare at environmentcopy
+ {\@firstofone}%
+ {\@firstofone}}
+\long\def\declare at environmentcopy#1#2#3#4{%
+ \def\reserved at a{#3}%
+ \@ifundefined\reserved at a{#1}{#2}%
+ {\ExpandArgs{cc}\declare at commandcopy@do{#3}{#4}%
+ \ExpandArgs{cc}\declare at commandcopy@do{end#3}{end#4}}}
% \end{macrocode}
% \emph{this needs fixing because \cs{ShowCommand} already shows
% the env definition if defined by \cs{NewDocumentEnvironment} so
More information about the latex3-commits
mailing list.