[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: In an @example, @comment at EOL swallows the following newline.
From: |
Eli Zaretskii |
Subject: |
Re: In an @example, @comment at EOL swallows the following newline. |
Date: |
Tue, 02 Jan 2018 17:55:18 +0200 |
> Date: Mon, 1 Jan 2018 20:59:38 +0000
> Cc: address@hidden, address@hidden
> From: Alan Mackenzie <address@hidden>
>
> > What bug did that cause in recent versions of makeinfo?
>
> In version 6.3, it caused a wanted linefeed to be lost. For example, if
> I delete the "@c"s in hereFn and sssTBasicOffset, the following source:
>
> @macro sssTBasicOffset
> <--> @address@hidden
> @end macro
>
> ............
>
> @example
> @group
> if (n > 0)
> @{m+=n; n=0;@} @hereFn{c-indent-one-line-block}
> @sssTBasicOffset{}
> @end group
> @end example
>
> @noindent
> and
>
> @example
> @group
> if (n > 0)
> @{ @hereFn{c-indent-one-line-block}
> m+=n; n=0;
> @}
> @end group
> @end example
>
> generates this (correct) output:
>
> if (n > 0)
> {m+=n; n=0;} <- c-indent-one-line-block
> <--> c-basic-offset
>
> and
>
> if (n > 0)
> { <- c-indent-one-line-block
> m+=n; n=0;
> }
>
>
> . With the "@c"s present, we get instead this (incorrect) output:
>
> if (n > 0)
> {m+=n; n=0;} <- c-indent-one-line-block<--> c-basic-offset
>
> and
>
> if (n > 0)
> { <- c-indent-one-line-block m+=n; n=0;
> }
>
> .
Add an extra newline to the macro. Or maybe even @* will work.
> > What's to warn about?
>
> That two adjacent lines in an @example (and maybe an @verbatim, too) are
> being joined into a single line because of the "@c ....." at the end of
> the first line.
But that's a feature, so why warn about it?
> > This trick is for versions of makeinfo which leave newlines in macro
> > expansions, since otherwise you will have trouble coming up with
> > macros that expand into Texinfo directives which need to be alone on
> > their lines, like "@item" or "@end SOMETHING".
>
> Ah, OK. :-) If I've read you correctly, you're saying that the "@c" in
> a macro would ensure that there was a linefeed at the end of the
> generated line, used in macros which generated, say, @item. The main use
> here would have been in ordinary text, not in @example.
No, it's the other way around: a macro _without_ @c will include the
newline in the expansion, because the "normal" use case expects that.
The few use cases where the newline needs to be removed use the @c
trick.
- Re: In an @example, @comment at EOL swallows the following newline., Gavin Smith, 2018/01/01
- Re: In an @example, @comment at EOL swallows the following newline., Eli Zaretskii, 2018/01/01
- Re: In an @example, @comment at EOL swallows the following newline., Gavin Smith, 2018/01/01
- Re: In an @example, @comment at EOL swallows the following newline., Gavin Smith, 2018/01/01
- Re: In an @example, @comment at EOL swallows the following newline., Eli Zaretskii, 2018/01/02