bug-texinfo
[Top][All Lists]
Advanced

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

Re: In an @example, @comment at EOL swallows the following newline.


From: Alan Mackenzie
Subject: Re: In an @example, @comment at EOL swallows the following newline.
Date: Mon, 1 Jan 2018 20:59:38 +0000
User-agent: Mutt/1.7.2 (2016-11-26)

Hello, Eli.

On Mon, Jan 01, 2018 at 22:01:29 +0200, Eli Zaretskii wrote:
> > Date: Mon, 1 Jan 2018 17:55:52 +0000
> > Cc: address@hidden
> > From: Alan Mackenzie <address@hidden>

> > > I believe you are right.  One place where this is definitely used is
> > > in some macros.

> > The actual source in cc-mode.texi which showed up the bug was indeed in
> > a macro, namely:

> >     @macro hereFn{func}
> >     <- @address@hidden
> >     @end macro

> > .  This macro was committed on 2003-05-12.  The @c at EOL2 looks like a
> > workaround for some glitch in an earlier version of makeinfo.  (As a
> > matter of interest, makeinfo 4.13 builds the source correctly, whether
> > or not the "@c" is present.).

> 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;
          }

.

> > This workaround could be present in a lot of files.texi that were being
> > actively modified around 15 years ago.  Again, would it be possible to
> > output a warning for this situation, and possibly document it in
> > texinfo's own documentation?

> 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.

> 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.

By contrast, "@c" in texinfo-6.3 is having the reverse effect: it's
causing a LF in the source to be missing from the generated .info.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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