bug-texinfo
[Top][All Lists]
Advanced

[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 13:28:18 +0100

On 23 June 2015 at 18:46, David Kastrup <address@hidden> wrote:
> It seems like a reasonable idea to quote { } inside of braces in order
> to allow for unmatched braces.  If one quotes those, one needs to quote
> \ for obvious reasons.  I would guess that this had been the original
> motivation for the quoting business.
>
> Distinguishing those two cases in the described manner should cover the
> LilyPond use case I think.  We don't use braces on the indexing macros
> in question.

The patch is below.

However, I've had problems trying to use braces in the arguments to
macros, with the current version. See the attached test file. I want
the index entry to be "\with}macro". I've tried various variations,
like:

@address@hidden
@address@hidden
@funindex{\\with\}macro}

This last one worked with texinfo.tex [version 2015-06-14.15], but not
with makeinfo:
macro-backslash2.texi:19: misplaced } (possibly involving @funindex)

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.

Sometimes texi2dvi went into an infinite loop. I had to delete
macro-backslash2.fn and macro-backslash2.fns afterwards to recover. It
could have been because I was using the old texindex, I'm not sure.

Index: doc/texinfo.tex
===================================================================
--- doc/texinfo.tex     (revision 6352)
+++ doc/texinfo.tex     (working copy)
@@ -7449,6 +7449,10 @@
 %
 % \anythingelse will almost certainly be an error of some kind.

+\def\macrolineargctxt{% used for whole-line arguments without braces
+  \scanctxt
+}
+
 % \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 +7799,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 +7832,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{%
@@ -7871,8 +7875,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}

Attachment: macro-backslash2.texi
Description: TeXInfo document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]