[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: In an @example, @comment at EOL swallows the following newline.
From: |
Gavin Smith |
Subject: |
Re: In an @example, @comment at EOL swallows the following newline. |
Date: |
Mon, 1 Jan 2018 23:02:53 +0000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Mon, Jan 01, 2018 at 10:23:23PM +0000, Gavin Smith wrote:
> There could be a case for changing makeinfo to be consistent with
> texinfo.tex, provided we can work out what texinfo.tex is doing.
>
So I believe in texinfo.tex, it's impossible for a @c within a macro
definition to comment out something that follows an invocation of the
macro. In the examples discussed here, that is the linefeed character at
the end of the line. (The @c in the macro body does remove a linefeed
character, but that is the linefeed character in the macro body itself.)
One idea is to change how macros are expanded in makeinfo to match what
is done in texinfo.tex, which is to always end a macro body with a @c
plus newline:
address@hidden
in the definition of \scanmacro. Here @texinfoc is aliased to @c and
\scantokens is an e-TeX primitive that supplies a newline at the very
end of its argument.
The change to makeinfo is the following, roughly:
Index: Texinfo/Parser.pm
===================================================================
--- Texinfo/Parser.pm (revision 7981)
+++ Texinfo/Parser.pm (working copy)
@@ -2098,6 +2098,8 @@ sub _expand_macro_body($$$$) {
my ($self, $macro, $args, $line_nr) = @_;
my $macrobody = $macro->{'macrobody'};
+ $macrobody .= "address@hidden";
+ warn "MACRO BODT IS |$macrobody|\n";
my $args_total = scalar(@{$macro->{'element'}->{'args'}}) -1;
my $args_index = $macro->{'args_index'};
@@ -3915,7 +3917,7 @@ sub _parse_texi($;$)
my $expanded_lines = _text_to_lines($expanded);
next if (address@hidden);
- chomp ($expanded_lines->[-1]);
+ #chomp ($expanded_lines->[-1]);
pop @$expanded_lines if ($expanded_lines->[-1] eq '');
print STDERR "MACRO EXPANSION LINES: ".join('|', @$expanded_lines)
."|\nEND LINES MACRO EXPANSION\n" if
($self->{'DEBUG'});
This could have similar benefits like stopping a control sequence at the
end of a macro merging with text after the invocation, which doesn't
happen with TeX:
@macro m
@c
@end macro
@m{}fff
leading to an error message about an unknown control sequence "@cfff". I
remember seeing this happen once with an old file.
This needs a lot of testing before it's done. I believe I tried a similar
change before but it led to a few changes in the results in makeinfo's
test suite, which I didn't investigate fully.
- 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 <=
- Re: In an @example, @comment at EOL swallows the following newline., Eli Zaretskii, 2018/01/02