[latex3-commits] [git/LaTeX3-latex3-latex2e] gh778: Fix result of \@ifdefinable on the empty cs (952afcb8)
PhelypeOleinik
phelype.oleinik at latex-project.org
Mon Jun 13 04:31:34 CEST 2022
Repository : https://github.com/latex3/latex2e
On branch : gh778
Link : https://github.com/latex3/latex2e/commit/952afcb8ef70ed3a2d998c643febc8a399525b35
>---------------------------------------------------------------
commit 952afcb8ef70ed3a2d998c643febc8a399525b35
Author: PhelypeOleinik <phelype.oleinik at latex-project.org>
Date: Sun Jun 12 23:31:34 2022 -0300
Fix result of \@ifdefinable on the empty cs
fixes #778
>---------------------------------------------------------------
952afcb8ef70ed3a2d998c643febc8a399525b35
base/ltdefns.dtx | 27 +++++++++++++++++++++++++--
base/ltexpl.dtx | 9 ++++++++-
base/testfiles/github-0778.tlg | 24 +++++++++++++++++++++---
3 files changed, 54 insertions(+), 6 deletions(-)
diff --git a/base/ltdefns.dtx b/base/ltdefns.dtx
index 9e1fa43f..b5375d84 100644
--- a/base/ltdefns.dtx
+++ b/base/ltdefns.dtx
@@ -32,7 +32,7 @@
%<*driver>
% \fi
\ProvidesFile{ltdefns.dtx}
- [2022/05/13 v1.5q LaTeX Kernel (definition commands)]
+ [2022/06/12 v1.5r LaTeX Kernel (definition commands)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltdefns.dtx}
@@ -671,15 +671,20 @@
% \changes{v1.0n}{1994/05/10}{Removed braces around \cs{@ifundefined}
% argument. ASAJ.}
% \changes{v1.0s}{1994/05/13}{Coded more efficiently, thanks to FMi.}
+% \changes{v1.5r}{2022/06/12}{Fix result of \cs{@ifdefinable} on the empty cs (gh/778).}
%
% \begin{macro}{\@ifdefinable}
% \begin{macro}{\@@ifdefinable}
% \begin{macro}{\@rc at ifdefinable}
% Test if user is allowed to define a command.
% \begin{macrocode}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2022/11/01}{\@ifdefinable}
+%<latexrelease> {Fix \cs{@ifdefinable} on the empty cs}%
\long\def\@ifdefinable #1#2{%
\edef\reserved at a{\expandafter\@gobble\string #1}%
- \@ifundefined\reserved at a
+ \@expl at cs@if at free@@NTF #1%
{\edef\reserved at b{\expandafter\@carcube \reserved at a xxx\@nil}%
\ifx \reserved at b\@qend \@notdefinable\else
\ifx \reserved at a\@qrelax \@notdefinable\else
@@ -687,7 +692,25 @@
\fi
\fi}%
\@notdefinable}
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>
+%<latexrelease>\IncludeInRelease{0000/00/00}{\@ifdefinable}
+%<latexrelease> {Fix \cs{@ifdefinable} on the empty cs}%
+%<latexrelease>\long\def\@ifdefinable #1#2{%
+%<latexrelease> \edef\reserved at a{\expandafter\@gobble\string #1}%
+%<latexrelease> \@ifundefined\reserved at a
+%<latexrelease> {\edef\reserved at b{\expandafter\@carcube \reserved at a xxx\@nil}%
+%<latexrelease> \ifx \reserved at b\@qend \@notdefinable\else
+%<latexrelease> \ifx \reserved at a\@qrelax \@notdefinable\else
+%<latexrelease> #2%
+%<latexrelease> \fi
+%<latexrelease> \fi}%
+%<latexrelease> \@notdefinable}
+%<latexrelease>\EndIncludeInRelease
+%</2ekernel|latexrelease>
+%<*2ekernel>
% \end{macrocode}
+%
% Saved definition of |\@ifdefinable|.
% \begin{macrocode}
\let\@@ifdefinable\@ifdefinable
diff --git a/base/ltexpl.dtx b/base/ltexpl.dtx
index aab189be..06cbc071 100644
--- a/base/ltexpl.dtx
+++ b/base/ltexpl.dtx
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltexpl.dtx}
- [2022/02/28 v1.3f LaTeX Kernel (expl3-dependent code)]
+ [2022/06/12 v1.3g LaTeX Kernel (expl3-dependent code)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltexpl.dtx}
@@ -371,6 +371,12 @@
\cs_gset_eq:NN \@expl at char@generate@@nn \char_generate:nn
% \end{macrocode}
%
+% \changes{v1.3g}{2022/06/12}
+% {Add \cs{@expl at cs@if at free@@NTF} for \cs{@ifdefinable} (gh/778)}
+% \begin{macrocode}
+\cs_gset_eq:NN \@expl at cs@if at free@@NTF \cs_if_free:NTF
+% \end{macrocode}
+%
% \begin{macrocode}
\ExplSyntaxOff
% \end{macrocode}
@@ -390,6 +396,7 @@
%<latexrelease>\let \@expl at cs@argument at spec@@N \@undefined
%<latexrelease>\let \@expl at cs@replacement at spec@@N \@undefined
%<latexrelease>\let \@expl at str@map at function@@NN \@undefined
+%<latexrelease>% \let \@expl at cs@if at free@@NTF \@undefined
%<latexrelease>\EndIncludeInRelease
%</2ekernel|latexrelease>
% \end{macrocode}
diff --git a/base/testfiles/github-0778.tlg b/base/testfiles/github-0778.tlg
index ffbcf207..8616be3e 100644
--- a/base/testfiles/github-0778.tlg
+++ b/base/testfiles/github-0778.tlg
@@ -11,14 +11,32 @@ If that doesn't work, type X <return> to quit.
->A.
<argument> \csname\endcsname
l. ......ndafter}\expandafter\test\csname\endcsname
-> \csname\endcsname=\long macro:
-->B.
-<argument> \csname\endcsname
+! LaTeX Error: Command \csname\endcsnamealready defined.
+ Or name \end... illegal, see p.192 of the manual.
+See the LaTeX manual or LaTeX Companion for explanation.
+Type H <return> for immediate help.
+ ...
l. ......ndafter}\expandafter\test\csname\endcsname
+Your command was ignored.
+Type I <command> <return> to replace it with another command,
+or <return> to continue without it.
> \csname\endcsname=\long macro:
->A.
<argument> \csname\endcsname
l. ......ndafter}\expandafter\test\csname\endcsname
+! LaTeX Error: Command \csname\endcsnamealready defined.
+ Or name \end... illegal, see p.192 of the manual.
+See the LaTeX manual or LaTeX Companion for explanation.
+Type H <return> for immediate help.
+ ...
+l. ......ndafter}\expandafter\test\csname\endcsname
+Your command was ignored.
+Type I <command> <return> to replace it with another command,
+or <return> to continue without it.
+> \csname\endcsname=macro:
+->\romannumeral \ifx \protect \@typeset at protect \expandafter \expandafter \expandafter \expandafter \expandafter \expandafter \expandafter \z@ \else \expandafter \z@ \expandafter \protect \fi \end .
+<argument> \csname\endcsname
+l. ......ndafter}\expandafter\test\csname\endcsname
> \end=\long macro:
->B.
\test ...onment {}{A}{B} \par \show #1 \show \end
More information about the latex3-commits
mailing list.