On Thu, Feb 21, 2013 at 10:38:39PM +0200, Eli Zaretskii wrote:
>
> @macro xxx {one}@c
> @set \one\@c
> @end macro
>
> @macro yyy {one, two}@c
> @xxx{x\one\}@c
> @ifclear x@c
> \one\@w{}\two\@c
> @end ifclear
> @clear x\one\@c
> @end macro
>
> @macro trampfn {method, user, host, localname}@c
>
> @value{prefix}@yyy{\method\,@value{postfixhop}}@yyy{\user\,@@}\host\@value{postfix}\localname\@c
> @end macro
>
> The important one is the last one: it needs to produce results like
> this:
>
> @file{@trampfn{smb, daniel%BIZARRE, melancholia, /daniel$$/.emacs}}
>
> => `/smb:daniel%BIZARRE@melancholia:/daniel$$/.emacs'
In the new implementation, the result not that, because the last newline
of a user macro invocation is always stripped, and it remains a mystery
why previous makeinfo processed that right as it also stripped the last
newline -- maybe not consistently.
More precisely
@trampfn{, user, host, localname}
leads first to
@value{prefix}@yyy{,@value{postfixhop}}@yyy{user,@@}host@value{postfix}localname@c
The next expansion is
/@xxx{x}@c
@ifclear x@c
@w{}@value{postfixhop}@c
@end ifclear
@clear x@c@yyy{user,@@}host@value{postfix}localname@c
At this point it is already clear that things cannot end well. The
final expansion is thus not what was intended:
/@set x@c@c
@clear x@c@yyy{user,@@}host@value{postfix}localname@c
I think that this issue is not the same as the issue of @c being removed
or kept, the issue comes from the newline at the end of @yyy being
removed. If the @c are removed from macro definition, the issue
remains, leading to something along
/@set x
@clear x@ayyy{user,@@}host@value{postfix}localname
Adding an end of line in the @macro definition, however:
@macro byyy {one, two}
@xxx{x\one\}@c
@ifclear x@c
\one\@w{}\two\@c
@end ifclear
@clear x\one\@c
@end macro
solves most of the problem, leading to:
/@set x@c@c
@clear x@c
@set xuser@c@c
user@w{}@@@c
@clear xuser@c
host:localname@c
The last @c may be problematic if in an @-command, such as in @file,
but then this is an issue covered in the Texinfo mannual, stating
On the other hand, you wouldn't want the '@c' if the macro was
sometimes invoked in the middle of a line (the text after the
invocation would be treated as a comment).
So, there is a fix:
* add a blank line in @yyy definition.
* Remove the trailing @c in @trmpfn definition.
Would that be ok? In my testings TeX gives also a correct result.
note: there is also still a spurious warning about @end in @file,
I'll correct that.
--
Pat