bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Macros in @deffn


From: Karl Berry
Subject: Re: Macros in @deffn
Date: Sat, 24 Apr 2004 19:47:27 -0400

    For some reason, the following macro @acro cannot be used in @deffn,
    while its expansion is.

And this surprises you :)?

    which means that the expansion is not properly made by makeinfo?

Yes, I fear this is another case like an @item of a @table, where
makeinfo does not expand macros.  When I tried some time ago, I couldn't
get that to work reliably.

Thus, makeinfo is passing the definition of @acro and the call to
texinfo.tex, so it might be able to do the expansion.  I kludged up some
code there so that your case does not fail, although more complex macro
invocations certainly could.  (And they won't be sorted properly in the
index, either.)

Basically, constructs like this each the point where all the kludges
upon kludges upon kludges in the implementations simply start to break down.

k

*** texinfo.tex 18 Apr 2004 17:16:13 -0000      1.155
--- texinfo.tex 24 Apr 2004 23:45:01 -0000
***************
*** 3278,3283 ****
--- 3278,3286 ----
    \def\point{.}%
    \def\print{-|}%
    \def\result{=>}%
+   %
+   % Don't write macro names.
+   \emptyusermacros
  }
  
  \let\indexbackslash=0  %overridden during \printindex.
***************
*** 5733,5742 ****
      \expandafter\parsearg
    \fi \next}
  
! % We mant to disable all macros during \shipout so that they are not
  % expanded by \write.
  \def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
    \edef\next{\macrolist}\expandafter\endgroup\next}
  
  
  % @alias.
--- 5736,5760 ----
      \expandafter\parsearg
    \fi \next}
  
! % We want to disable all macros during \shipout so that they are not
  % expanded by \write.
  \def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
    \edef\next{\macrolist}\expandafter\endgroup\next}
+ 
+ % For \indexnofonts, we need to get rid of all macros, leaving only the
+ % arguments (if present).  Of course this is not nearly correct, but it
+ % is the best we can do for now.  makeinfo does not expand macros in the
+ % argument to @deffn, which ends up writing an index entry, and texindex
+ % isn't prepared for an index sort entry that starts with \.
+ % 
+ % Since macro invocations are followed by braces, we can just redefine them
+ % to take a single TeX argument.  The case of a macro invocation that
+ % goes to end-of-line is not handled.
+ % 
+ \def\emptyusermacros{\begingroup
+   \def\do##1{\let\noexpand##1=\noexpand\identity}%
+   \edef\next{\macrolist}\expandafter\endgroup\next}
+ \def\identity#1{#1}
  
  
  % @alias.




reply via email to

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