[latex3-commits] [git/LaTeX3-latex3-latex2e] gh239: Revert \@copy at DeclareTextCommand (13d3afac)

PhelypeOleinik tex.phelype at gmail.com
Fri Aug 14 21:37:18 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : gh239
Link       : https://github.com/latex3/latex2e/commit/13d3afac19ffbe1613c67950d2881f1588505293

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

commit 13d3afac19ffbe1613c67950d2881f1588505293
Author: PhelypeOleinik <tex.phelype at gmail.com>
Date:   Fri Aug 14 16:37:18 2020 -0300

    Revert \@copy at DeclareTextCommand


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

13d3afac19ffbe1613c67950d2881f1588505293
 base/ltoutenc.dtx | 355 ++----------------------------------------------------
 1 file changed, 8 insertions(+), 347 deletions(-)

diff --git a/base/ltoutenc.dtx b/base/ltoutenc.dtx
index 84d0dc85..c6bfc149 100644
--- a/base/ltoutenc.dtx
+++ b/base/ltoutenc.dtx
@@ -37,14 +37,14 @@
 %<TS1>\ProvidesFile{ts1enc.def}[2001/06/05 v3.0e (jk/car/fm)
 %<TU>\ProvidesFile{tuenc.def}
 %<package>\ProvidesPackage{fontenc}
-%<OT1|T1|OMS|OML|OT4|TU|package> [2020/04/22 v2.0p
+%<OT1|T1|OMS|OML|OT4|TU|package> [2020/08/10 v2.0s
 %<OT1|T1|OMS|OML|OT4|TS1|TU>      Standard LaTeX file]
 %<package>                        Standard LaTeX package]
 %
 %<*driver>
 % \fi
 \ProvidesFile{ltoutenc.dtx}
-             [2021/07/04 v2.0q LaTeX Kernel (font encodings)]
+             [2020/08/10 v2.0s LaTeX Kernel (font encodings)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltoutenc.dtx}
@@ -384,10 +384,10 @@
 %    \begin{quote}
 %      |\DeclareTextSymbolDefault{|^^A
 %         \meta{command}|}|^^A
-%         |{|\meta{encoding}|}|\\
+%         \meta{encoding}|}|\\
 %      |\DeclareTextAccentDefault{|^^A
 %         \meta{command}|}|^^A
-%         |{|\meta{encoding}|}|
+%         \meta{encoding}|}|
 %    \end{quote}
 %    are short for:
 %    \begin{quote}
@@ -1082,8 +1082,9 @@
 %    deficiencies, see pr/3160.
 % \task{?}{Improve this and document its problems, see pr/3160}
 % \changes{v1.9z}{2000/01/30}{Macro reimplemented (pr/3160)}
+% \changes{v2.0r}{2020/07/27}{Don't make the command \cs{long} (gh/354)}
 %    \begin{macrocode}
-\DeclareRobustCommand\UseTextAccent[3]{%
+\DeclareRobustCommand*\UseTextAccent[3]{%
   \hmode at start@before at group
    {%
 %    \end{macrocode}
@@ -1098,8 +1099,9 @@
 %    \end{macrocode}
 %
 % \changes{v1.9z}{2000/01/30}{Macro reimplemented (pr/3160)}
+% \changes{v2.0r}{2020/07/27}{Don't make the command \cs{long} (gh/354)}
 %    \begin{macrocode}
-\DeclareRobustCommand\UseTextSymbol[2]{%
+\DeclareRobustCommand*\UseTextSymbol[2]{%
        \hmode at start@before at group
        {%
           \def\@wrong at font@char{\MessageBreak
@@ -1233,341 +1235,6 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \subsubsection{Copying font commands}
-%
-% \begin{macro}{\@if at DeclareTextCommand}
-% \changes{v1.5h}{2020/05/09}{Added \cs{DeclareCommandCopy} (gh/239)}
-%
-%   With the generic \cs{NewCommandCopy} macro defined earlier in
-%   \texttt{ltdefns.dtx}, we can make a |\@if@|--|\@copy@| pair for
-%   \cs{DeclareTextCommand}.
-%
-%    \begin{macrocode}
-%</2ekernel>
-%<latexrelease>\IncludeInRelease{2020-10-01}{\@if at DeclareTextCommand}
-%<latexrelease>  {Add \@if at DeclareTextCommand
-%<latexrelease>   and \@copy at DeclareTextCommand}%
-%<*2ekernel|latexrelease>
-%    \end{macrocode}
-%
-%   Checking if a command is defined with \cs{DeclareTextCommand} is a
-%   bit trickier than ones defined with \cs{DeclareRobustCommand}
-%   because the \cs{meaning} of the defined command doesn't only depend
-%   on the name of the command itself, but also on the default encoding
-%   declared for the command.  The \cs{meaning} of such a command
-%   |\foo| defined with \cs{DeclareTextCommand} is:
-%   |\<enc>-cmd \foo \<enc>\foo|.  Without knowing what encoding |<enc>|
-%   is we can't guess a definition for |\foo| and compare to check if
-%   they are equal.  The solution implemented here compares the
-%   \cs{meaning} of the command with the template above, and if it fits,
-%   then \cs{@if at DeclareTextCommand} will branch to true.
-%    \begin{macrocode}
-\def\@if at DeclareTextCommand#1{%
-  \begingroup
-    \escapechar`\\
-%    \end{macrocode}
-%   We need to take extra care about control symbols like |\'|: their
-%   meaning is something like \verb*=\?-cmd \'\?\' =, whereas control
-%   words have a space after the second token: \verb*=\?-cmd \x \?\x =.
-%   Here \cs{reserved at b} will expand to a space or to empty.
-%    \begin{macrocode}
-    \edef\reserved at a{\string#1}%
-    \edef\reserved at b{\detokenize{#1}}%
-    \edef\reserved at b{\ifx\reserved at a\reserved at b\else\space\fi}%
-%    \end{macrocode}
-%   Here we start an exhaustive expansion of the rest of the macro.
-%   \cs{reserved at a} is defined to have the template discussed above as
-%   \meta{parameter text} and then match the \cs{meaning} of the command
-%   being tested, and expand to \meta{true} or \meta{false} accordingly.
-%    \begin{macrocode}
-    \begingroup\edef\x{\endgroup
-    \def\noexpand\reserved at a####1%
-      \detokenize{macro}:->%
-        \@backslashchar####2\detokenize{-cmd }%
-        \string#1\reserved at b
-        \@backslashchar####3\string#1 \noexpand\@nil
-          ####4\noexpand\@nnil\unexpanded{{%
-  \endgroup
-  \if x\ifx\relax##2y\fi
-       \ifx\relax##3y\fi x%
-    \expandafter\@firstoftwo
-  \else
-    \expandafter\@secondoftwo
-  \fi}}%
-%    \end{macrocode}
-%   Now just call \cs{reserved at a} with the \cs{meaning} of |#1| and with
-%   a fallback text to match the definition of \cs{reserved at a}, but with
-%   \cs{relax} in place of the encoding to signal that the function
-%   should expand to false.
-%    \begin{macrocode}
-  \noexpand\reserved at a
-    \meaning#1\noexpand\@nil
-    \detokenize{macro}:->%
-      \@backslashchar\relax\detokenize{-cmd }%
-      \string#1\reserved at b
-      \@backslashchar\relax\string#1 \noexpand\@nil
-    \noexpand\@nnil}%
-  \x}
-%    \end{macrocode}
-%
-% \begin{macro}{\@loaded at encoding@list}
-%   Commands defined with \cs{DeclareTextCommand} have multiple possible
-%   versions, depending on the encoding of the font used, and encoding
-%   defaults declared for that command.  To make sure we catch all
-%   possibilities, we list all encodings loaded by the \LaTeXe{} kernel
-%   by default, and extend it with \cs{@fontenc at load@list}:
-%    \begin{macrocode}
-\def\@loaded at encoding@list{OML,OMS,TS1}
-%    \end{macrocode}
-%
-% \begin{macro}{\@copy at DeclareTextCommand}
-%   To copy a command here, start by expanding (in a group) the list of
-%   loaded encodings, and then |x|-expand:
-%    \begin{macrocode}
-\def\@copy at DeclareTextCommand#1#2{%
-  \begingroup
-    \escapechar=`\\
-    \def\@elt##1{,##1}%
-    \edef\@loaded at encoding@list{%
-      \@loaded at encoding@list\@fontenc at load@list}%
-    \edef\x{\endgroup
-%    \end{macrocode}
-%
-%   Here we define the top-level macro |#1| as:
-%   \verb*=\<enc>-cmd #1 \<enc>\#1=, using
-%   \cs{@copy at declaretextcommand@enc} to take the name of the default
-%   encoding from the command being copied (|#2|):
-%    \begin{macrocode}
-  \def\noexpand#1{%
-    \expandafter\noexpand\csname
-      \expandafter\@copy at declaretextcommand@enc
-        \meaning#2\@nil-cmd\endcsname
-    \noexpand#1%
-    \expandafter\noexpand\csname
-      \expandafter\@copy at declaretextcommand@enc
-        \meaning#2\@nil\string#1\endcsname}%
-%    \end{macrocode}
-%
-%   Finally, call \cs{@copy at declaretextcommand} in a loop to copy
-%   |\<enc>\#2| into |\<enc>\#1| for the default (|?|) then for every
-%   \meta{enc} in \cs{@loaded at encoding@list}:
-%    \begin{macrocode}
-  \noexpand\@for\noexpand\@elt:=?,\@loaded at encoding@list\noexpand\do
-    {\unexpanded{%
-      \expandafter\@copy at declaretextcommand\expandafter{\@elt}#1#2}%
-        {\@expl at cs@to at str@@N#1}{\@expl at cs@to at str@@N#2}%
-    }%
-  }\x}
-%    \end{macrocode}
-%
-% \begin{macro}{\@copy at declaretextcommand}
-% \begin{macro}{\@unexpanded at cdrcar}
-% \begin{macro}{\@copy at declaretextcommand@defaults}
-%   Now \cs{@copy at declaretextcommand} just checks if |\<enc>\#2| exists,
-%   and then prepares the arguments for
-%   \cs{@copy at declaretextcommand@defaults}, which will examine if the
-%   command has an encoding default or is a composite command declared
-%   with \cs{DeclareTextCompositeCommand}, and define it accordingly,
-%   otherwise it will simply copy the command:
-%    \begin{macrocode}
-\def\@copy at declaretextcommand#1#2#3#4#5{%
-  \@ifundefined{#1\@backslashchar#5}{}{%
-    \begingroup\edef\x{\endgroup
-    \noexpand\@copy at declaretextcommand@defaults
-      \expandafter\expandafter\expandafter\@unexpanded at cdr@car
-        \csname#1\@backslashchar#5\endcsname XXX\@nil
-      \noexpand#2%
-      \noexpand#3%
-      \expandafter\noexpand\csname#1\@backslashchar#4\endcsname
-      \expandafter\noexpand\csname#1\@backslashchar#5\endcsname
-      {#1}%
-    }\x}}
-\def\@unexpanded at cdr@car#1#2#3#4\@nil{\unexpanded{{#2}}}
-\def\@copy at declaretextcommand@defaults#1#2#3#4#5#6{%
-  \long\def\reserved at a{\UseTextSymbol{#1}#3}%
-  \ifx\reserved at a#5%
-    \long\def#4{\UseTextSymbol{#1}#2}%
-  \else
-    \long\def\reserved at a{\UseTextAccent{#1}#3}%
-    \ifx\reserved at a#5%
-      \long\def#4{\UseTextAccent{#1}#2}%
-    \else
-      \@if at text@composite at copy@else#4#5{#6}%
-        {\declare at command@copy at let#4#5}%
-    \fi
-  \fi}
-%    \end{macrocode}
-%
-% \begin{macro}{\@if at text@composite at copy@else}
-%   This command checks if the text command being copied is a text
-%   composite command.  Text composites are declared differently for
-%   each argument \meta{char}, and are stored as
-%   |\\|\meta{enc}|\|\meta{cmd}-\meta{char}, so we can't copy them
-%   unless we know every \meta{char} that was declared.  To completely
-%   copy a composite we define a list of characters used in composites
-%   for each encoding, and when copying we cycle through that list
-%   copying the command when defined.  \cs{@copy at text@composite} takes
-%   care of copying a composite.
-%    \begin{macrocode}
-\def\@if at text@composite at copy@else#1#2#3{%
-  \begingroup
-    \escapechar=`\\
-    \edef\x{\endgroup
-%    \end{macrocode}
-%
-%   Here we use the same approach as in \cs{@if at DeclareTextCommand}:
-%   define a temporary macro with a template text and then check if the
-%   macro we're copying matches.  Here's the macro that will make the
-%   test:
-%    \begin{macrocode}
-  \def\noexpand\reserved at a####1\detokenize{%
-    macro:}\string##1->%
-      \detokenize{\@text at composite#2}\string##1\detokenize{\@empty
-      \@text at composite}####2\noexpand\@nil{%
-    \noexpand\ifx\relax####2\unexpanded{%
-      \expandafter\@secondoftwo
-    \else
-      \expandafter\@firstoftwo
-    \fi}}%
-%    \end{macrocode}
-%
-%   And here we use it on \cs{meaning}\verb=#2=:
-%    \begin{macrocode}
-  \noexpand\reserved at a\meaning#2\detokenize{%
-    macro:}\string##1->%
-      \detokenize{\@text at composite#2}\string##1\detokenize{\@empty
-      \@text at composite}{\relax}\noexpand\@nil
-%    \end{macrocode}
-%
-%   If the test is true, call \cs{@copy at text@composite} to do the
-%   copying.
-%    \begin{macrocode}
-  }\x{\@copy at text@composite#1#2{#3}%
-      \@gobble}%
-     {\@firstofone}}
-%    \end{macrocode}
-%
-% \begin{macro}{\@copy at text@composite}
-%   Copying the composite command is rather easy, as we can temporarily
-%   redefine \cs{@text at composite} to do the hard work for us.
-%    \begin{macrocode}
-\def\@copy at text@composite#1#2#3{%
-  \begingroup
-    \def\@text at composite##1##2\@text at composite##3{%
-  \endgroup
-  \def#1####1{\@text at composite#1##2\@text at composite{##3}}}%
-  #2{##1}%
-%    \end{macrocode}
-%
-%   Now expand the list of composites for the current (being copied)
-%   encoding (\verb=#3=) and call \cs{@copy at one@composite} with the new
-%   name, the old name, and one item in the list.
-%    \begin{macrocode}
-  \begingroup
-    \escapechar=`\\
-    \edef\x{\endgroup
-  \noexpand\@copy at one@composite
-    {\string#1}{\string#2}%
-%    \end{macrocode}
-%
-%   If the list of composites for an encoding is not defined, end
-%   \cs{@copy at one@composite} early and raise an error:
-%    \begin{macrocode}
-    \expandafter\ifx\csname @list@#3enc at composites\endcsname\relax
-      \unexpanded{\@nnil\@nil
-        \@latex at error{List of composites undefined for encoding #3}\@ehc}%
-    \else
-      \unexpanded\expandafter\expandafter
-        \expandafter{\csname @list@#3enc at composites\endcsname
-          \@nnil\@nil}%
-    \fi}%
-  \x}
-%    \end{macrocode}
-%
-% \begin{macro}{\@copy at one@composite}
-% \begin{macro}{\@copy at composite@stop}
-%   To actually make the copy, use just \cs{ifcsname} as it prevents the
-%   csname from being added to the hash table, and makes the whole thing
-%   a bit faster, since it doesn't require the two test from
-%   \cs{@ifundefined} (as a side effect, commands that are equal to
-%   \cs{relax} are copied through, but then, it's unlikely).
-%    \begin{macrocode}
-\def\@copy at one@composite#1#2#3{%
-  \ifx\@nnil#3\@copy at composite@stop\fi
-  \ifcsname#2-\string#3\endcsname
-    \expandafter
-      \let\csname#1-\string#3\expandafter\endcsname
-          \csname#2-\string#3\endcsname
-  \fi
-  \@copy at one@composite{#1}{#2}}
-\def\@copy at composite@stop\fi#1\@copy at one@composite#2\@nil{\fi}
-%    \end{macrocode}
-%
-% \begin{macro}{\@list at TUenc@composites}
-% \begin{macro}{\@list at OT4enc@composites}
-% \begin{macro}{\@list at OT1enc@composites}
-% \begin{macro}{\@list at T1enc@composites}
-%   Now just define the list of available composites for each encoding
-%   defined later on in this file:
-%    \begin{macrocode}
-\@namedef{@list at TUenc@composites}{%
-  {\@empty}%
-  {a}{\ae}{b}{c}{d}{e}{g}{h}{\i}{i}{j}%
-  {A}{\AE}{B}{C}{D}{E}{G}{H}{\j}{I}{J}%
-  {k}{l}{m}{n}{o}{r}{s}{t}{u}{v}{w}{y}{z}%
-  {K}{L}{M}{N}{O}{R}{S}{T}{U}{V}{W}{Y}{Z}}
-\@namedef{@list at OT4enc@composites}{%
-  {a}{c}{e}{n}{o}{s}{z}%
-  {A}{C}{E}{N}{O}{S}{Z}}
-\@namedef{@list at OT1enc@composites}{%
-  {A}{g}{\i}{i}}
-\@namedef{@list at T1enc@composites}{%
-  {a}{c}{d}{e}{g}{\i}{i}{k}{l}{n}{o}{r}{s}{t}{u}{y}{z}
-  {A}{C}{D}{E}{G}    {I}{K}{L}{N}{O}{R}{S}{T}{U}{Y}{Z}}
-%    \end{macrocode}
-%
-%   Here's the \cs{@copy at declaretextcommand@enc} auxiliary:
-%    \begin{macrocode}
-\begingroup\edef\x{\endgroup
-\def\noexpand\@copy at declaretextcommand@enc
-  \detokenize{macro}:->%
-    \@backslashchar##1\detokenize{-cmd}##2\noexpand\@nil}\x{#1}
-%    \end{macrocode}
-%
-%   Finally, add both \cs{@if at DeclareTextCommand} and
-%   \cs{@copy at DeclareTextCommand} to \cs{@declarecommandcopylisthook}:
-%    \begin{macrocode}
-\edef\@declarecommandcopylisthook{%
-  \unexpanded\expandafter{\@declarecommandcopylisthook
-    {\@if at DeclareTextCommand \@copy at DeclareTextCommand}}}
-%    \end{macrocode}
-%
-%   Now the rollback code.
-%    \begin{macrocode}
-%</2ekernel|latexrelease>
-%<latexrelease>\EndIncludeInRelease
-%<latexrelease>\IncludeInRelease{0000-00-00}{\@if at DeclareTextCommand}
-%<latexrelease>  {Undefine \@if at DeclareTextCommand
-%<latexrelease>   and \@copy at DeclareTextCommand}%
-%<latexrelease>\let\@if at DeclareTextCommand\@undefined
-%<latexrelease>\let\@copy at DeclareTextCommand\@undefined
-%<latexrelease>\EndIncludeInRelease
-%<*2ekernel>
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
 %
 % \subsubsection{Hyphenation}
 %
@@ -3234,12 +2901,6 @@
     \else
       \newluafunction\@remove at tlig@@@@
 %    \end{macrocode}
-% We are in the format and Lua functions can not be dumped, so we have to repeat
-% the code during |\everyjob|. Therefore we first define a helper to both execute
-% some code and same it for |\everyjob|:
-%    \begin{macrocode}
-      \def\now at and@everyjob#1{\toksapp\everyjob{#1}#1}
-%    \end{macrocode}
 % Now we can define the function. Mostly we just have to insert a protected glyph
 % node, which is a glyph node with subtype 256. But we have to keep track of the
 % current mode to avoid inserting the glyph into a vlist.





More information about the latex3-commits mailing list.