[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: backslashes, macros, indexes, texinfo
From: |
Gavin Smith |
Subject: |
Re: backslashes, macros, indexes, texinfo |
Date: |
Wed, 24 Jun 2015 14:01:32 +0100 |
On 24 June 2015 at 13:28, Gavin Smith <address@hidden> wrote:
> This makes sense because we'd need to invoke @findex like "@findex
> address@hidden" but it's being invoked like "@findex \with}macro". With
> texinfo.tex, the \} is converted into a command to display an actual
> close brace glyph at an earlier stage, and it has no further
> interpretation as an end group character. I expect there's no portable
> way to pass braces in the argument to a macro.
"@funindex address@hidden" works with makeinfo, and also works with
texinfo.tex with the following, amended patch. The difference from the
previous patch is that { and } are given catcode \other when getting
the line argument. @ already had catcode \other, but it still works in
the macro expansion because all the characters are read in again in
\scanmacro.
Index: texinfo.tex
===================================================================
--- texinfo.tex (revision 6352)
+++ texinfo.tex (working copy)
@@ -7449,6 +7449,12 @@
%
% \anythingelse will almost certainly be an error of some kind.
+\def\macrolineargctxt{% used for whole-line arguments without braces
+ \scanctxt
+ \catcode`\{=\other
+ \catcode`\}=\other
+}
+
% \mbodybackslash is the definition of \ in @macro bodies.
% It maps \foo\ => \csname macarg.foo\endcsname => #N
% where N is the macro parameter number.
@@ -7795,7 +7801,7 @@
\noexpand\scanmacro{\temp}}%
\or % 1
\expandafter\xdef\csname\the\macname\endcsname{%
- \bgroup\noexpand\macroargctxt
+ \bgroup
\noexpand\braceorline
\expandafter\noexpand\csname\the\macname xxx\endcsname}%
\expandafter\xdef\csname\the\macname xxx\endcsname##1{%
@@ -7828,7 +7834,7 @@
\noexpand\scanmacro{\temp}\egroup}%
\or % 1
\expandafter\xdef\csname\the\macname\endcsname{%
- \bgroup\noexpand\macroargctxt
+ \bgroup
\noexpand\braceorline
\expandafter\noexpand\csname\the\macname xxx\endcsname}%
\expandafter\xdef\csname\the\macname xxx\endcsname##1{%
@@ -7864,6 +7870,7 @@
\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
% \braceorline decides whether the next nonwhitespace character is a
% {. If so it reads up to the closing }, if not, it reads the whole
% line. Whatever was read is then fed to the next control sequence
@@ -7871,8 +7878,8 @@
%
\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
\def\braceorlinexxx{%
- \ifx\nchar\bgroup\else
- \expandafter\parsearg
+ \ifx\nchar\bgroup\macroargctxt\else
+ \macrolineargctxt\expandafter\parsearg
\fi \macnamexxx}
- backslashes, macros, indexes, texinfo, Karl Berry, 2015/06/01
- Re: backslashes, macros, indexes, texinfo, Werner LEMBERG, 2015/06/02
- Re: backslashes, macros, indexes, texinfo, David Kastrup, 2015/06/02