Re: Generalising @def*

Gavin Smith <[email protected]>
Newsgroups gmane.comp.tex.texinfo.general
Message-ID <Y+ecPtvx+NTkgdi/@starmint>
On Sat, Feb 11, 2023 at 11:59:08AM +0000, Gavin Smith wrote:
> I have gone off the idea of using @macro for this.  I am thinking a
> more limited command would be better, as mentioned in an earlier message

I've committed a change to texinfo.tex for a new command @newdef.  Example
usage:

    @defcodeindex bi
    
    @newdef @defbuiltin = Builtin bi
    @newdef @defdoodad = Doodad {}
    
    @defblock
    @defbuiltin yeah (ok)
    @deflinex {Builtinoid} foo (bar)
    hello
    
    @defbuiltin something (else)
    more
    
    @defdoodad brick
    Description of the brick
    
    @end defblock
    
    
    @heading Builtin Index
    
    @printindex bi

{} is used to signify that the command does not produce index entries.

Note that multiple def lines can occur in a single @defblock.

I used spaces to separate the arguments to @newdef rather than commas
as this seemed easier to implement.  (We could still change this.)
The first argument should be surrounded by braces if it contains a space.

The only existing line commands that use commas are @node and
@definfoenclose (the latter of which should go away at some point).
The others (@synindex, @syncodeindex, @alias) use spaces or have
ad-hoc syntaxes.  The block command @float also takes two optional
arguments, separated by commas.

Optional arguments are not done in a straightforward manner in TeX so
they should be avoided in any new syntax.  

There should also be a @newdeftype command for defining commands that
act like @deftypefnx.  I'm unsure about the best way of doing this; if
in practice the @newdeftype command would be more used than @newdef, then
it should have a shorter name.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.