[latex3-commits] [git/LaTeX3-latex3-latex2e] gh222: Save a csname by using \@swaptoargs (bdd36eb7)
Johannes Braams
texniek at braams.xs4all.nl
Mon Jul 6 23:04:01 CEST 2020
Repository : https://github.com/latex3/latex2e
On branch : gh222
Link : https://github.com/latex3/latex2e/commit/bdd36eb719e448cdfb6bdb4f7e16d042defa6d45
>---------------------------------------------------------------
commit bdd36eb719e448cdfb6bdb4f7e16d042defa6d45
Author: Johannes Braams <texniek at braams.xs4all.nl>
Date: Mon Jul 6 23:04:01 2020 +0200
Save a csname by using \@swaptoargs
>---------------------------------------------------------------
bdd36eb719e448cdfb6bdb4f7e16d042defa6d45
required/tools/verbatim.dtx | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/required/tools/verbatim.dtx b/required/tools/verbatim.dtx
index 339ff891..4a6f8f88 100644
--- a/required/tools/verbatim.dtx
+++ b/required/tools/verbatim.dtx
@@ -506,7 +506,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{verbatim}
- [2020-07-05 v1.5t LaTeX2e package for verbatim enhancements]
+ [2020-07-06 v1.5t LaTeX2e package for verbatim enhancements]
\@ifundefined{verbatim@@@}{}{\endinput}
% \end{macrocode}
%
@@ -1574,21 +1574,25 @@
% Then everything is set up as in the |\verbatim| macro. But, as
% |\@verbatim| contains a call to |\every at verbatim| which
% \emph{might} contain an |\input| statement, which would overwrite
-% the contents of |\@filef at und|, we need to save that filename
-% temporarily.
-% \changes{v1.5s}{2020-06-06}{Save the contents of \cs{@filef at und}
-% before the call of \cs{@verbatim} (gh/222)}
+% the contents of |\@filef at und|, we need to save it by expanding it
+% first. The use of |\@swaptoargs| makes it so that the
+% \emph{expansion} of |\@filef at und| gets to be the second argument
+% of |\verbatim at readfile|.
+% \changes{v1.5t}{2020-07-06}{Expand \cs{@filef at und} before the call
+% of \cs{@verbatim} (gh/222)}m
% \begin{macrocode}
\def\verbatim at input#1#2{%
\IfFileExists {#2}{%
- \let\@verb at file\@filef at und
- \@verbatim #1\relax
+ \expandafter\@swaptwoargs\expandafter
+ {\expandafter{\@filef at und}}%
+ {\@verbatim #1\relax
% \end{macrocode}
% Then it reads in the file, finishes off the \texttt{trivlist}
% environment started by |\@verbatim| and closes the group.
% This restores everything to its normal settings.
% \begin{macrocode}
- \verbatim at readfile{\@verb at file}\endtrivlist\endgroup\@doendpe}%
+ \verbatim at readfile}
+ \endtrivlist\endgroup\@doendpe}%
% \end{macrocode}
% If the file is not found a more or less helpful message is
% printed. The final |\endgroup| is needed to close the group
More information about the latex3-commits
mailing list.