help-texinfo
[Top][All Lists]
Advanced

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

Re: Generalising @def*


From: Gavin Smith
Subject: Re: Generalising @def*
Date: Fri, 10 Feb 2023 13:35:15 +0000

On Thu, Feb 02, 2023 at 07:14:53PM +0000, Gavin Smith wrote:
> I imagine that there would be another type of block
> like @defblock ... @end defblock which could contain the @def lines,
> which would allow the same formatting without the use of @macro.

I expect that I'll be able to implement this in texinfo.tex.
My current work is at the end of this mail.

I've commented out the code to create the index entry in \printdefunline,
which until recently wasn't part of \printdefunline anyway, so it should
be straightforward to remove this once I reverse the changes to introduce
a @useindex command.  Apart from this, adding a new block command for
a definition block, along with new line commands to print definition lines,
seems straightforward.  With the patch below, the following input outputs
as you would expect.

\input texinfo

@defblock
@deflinex Functionoid bar (args)
@deflinex Monoid bar2 (args, nineyy)
hello

@end defblock

@bye 

I expect that once this is in texi2any, any @?index lines in
the @defblock should be handled along with recent/ongoing changes
for copiable anchor links for definition commands.

User-defined definition commands could be limited to macros that use
@deflinex (or similar line commands that we will introduce).  There
will be no definitions on the @defblock line itself.  Thus we can avoid
or delay the question of allowing users to define their own block commands
with a corresponding "@end" line.

I'll post more once this work is more complete.


diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index 0f57611a5e..b1e3cb8cee 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -7570,9 +7570,9 @@ might help (with 'rm \jobname.?? \jobname.??s')%
     % call \deffooheader:
     #1#2 \endheader
     % create the index entry
-    \defcharsdefault
-    \edef\temp{\noexpand\doind{\the\defidx}{\the\deftext}}%
-    \temp
+    % \defcharsdefault
+    % \edef\temp{\noexpand\doind{\the\defidx}{\the\deftext}}%
+    % \temp
     % common ending:
     \interlinepenalty = 10000
     \advance\rightskip by 0pt plus 1fil\relax
@@ -7587,6 +7587,19 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 
 \def\Edefun{\endgraf\medbreak}
 
+\envdef\defblock{%
+  \startdefun
+}
+\let\Edefblock\Edefun
+
+\def\deflineheader#1 #2 #3\endheader{%
+  \defname{#1}{}{#2}\magicamp\defunargs{#3\unskip}%
+}
+
+\def\deflinex{%
+    \parseargusing\activeparens{\printdefunline\deflineheader}%
+}
+
 % \makedefun{deffoo} (\deffooheader parameters) { (\deffooheader expansion) }
 %
 % Define \deffoo, \deffoox  \Edeffoo and \deffooheader.





reply via email to

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