Bug#815205: another texinfo.tex bug in \scanmacro
Gavin Smith
gavinsmith0123 at gmail.com
Tue Apr 12 16:23:14 UTC 2016
On 12 April 2016 at 09:05, Norbert Preining <preining at logic.at> wrote:
> Here is a minimal example extracted from the sbcl sources that shows
> the effect:
> \input texinfo @c -*-texinfo-*-
>
> @iftex
> @macro cl{name}
> {@smallertt at phantom{concurrency:}@llap{cl:}}\name\
> @end macro
> @end iftex
>
> Some text
>
> @tindex @cl{built-in-class}
> foo bar baz
>
> @printindex tp
>
>
> @bye
>
Thanks for sending, I believe the diff below fixes it. Please let me
know whether it works. These catcode changes were there before but I
must have removed them when the expansion of Texinfo macros no longer
took place within a TeX group. They're needed for macro expansion in
index entries, as you found.
Index: texinfo.tex
===================================================================
--- texinfo.tex (revision 7054)
+++ texinfo.tex (working copy)
@@ -5305,7 +5305,6 @@
\putwordIndexNonexistent
\else
\catcode`\\ = 0
- \escapechar = `\\
%
% If the index file exists but is empty, then \openin leaves \ifeof
% false. We have to make TeX try to read something from the file, so
@@ -6866,7 +6865,6 @@
\catcode `\>=\other
\catcode `\`=\other
\catcode `\'=\other
- \escapechar=`\\
%
% ' is active in math mode (mathcode"8000). So reset it, and all our
% other math active characters (just in case), to plain's definitions.
@@ -7844,15 +7842,27 @@
% alias because \c means cedilla in @tex or @math
\let\texinfoc=\c
+\newcount\savedcatcodeone
+\newcount\savedcatcodetwo
+
% Used at the time of macro expansion.
% Argument is macro body with arguments substituted
\def\scanmacro#1{%
\newlinechar`\^^M
\def\xeatspaces{\eatspaces}%
%
+ % Temporarily undo catcode changes of \printindex
+ \savedcatcodeone=\catcode`\@
+ \savedcatcodetwo=\catcode`\\
+ \catcode`\@=0
+ \catcode`\\=\active
+ %
% Process the macro body under the current catcode regime.
- \scantokens{#1\texinfoc}\aftermacro%
+ \scantokens{#1 at texinfoc}\aftermacro%
%
+ \catcode`\@=\savedcatcodeone
+ \catcode`\\=\savedcatcodetwo
+ %
% The \texinfoc is to remove the \newlinechar added by \scantokens, and
% can be noticed by \parsearg.
% The \aftermacro allows a \comment at the end of the macro definition
More information about the pkg-common-lisp-devel
mailing list