[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
removing the `de` macro and the old ".pl \n(nlu" trick
From: |
G. Branden Robinson |
Subject: |
removing the `de` macro and the old ".pl \n(nlu" trick |
Date: |
Wed, 31 Jul 2024 15:24:53 -0500 |
[resurrecting 26-month-old thread]
Hi Doug,
At 2023-05-03T09:29:15-0500, G. Branden Robinson wrote:
> > The same argument could be made about \applying .rm to any standard
> > request, and I would disagree for the same reason as above. (A
> > disappointing experimental discovery in this regard: .de seems to be
> > immune to removal.)
>
> I have good news for you! Removing `de` seems to work just fine for
> me in groff 1.22.4 and Git.
The example I offered to support my claim in May 2023 was not as
illustrative as it could have been; this recently came to my attention
and annoyed me.
So here's a better one.
$ nl EXPERIMENTS/remove-de-request.roff
1 .de A
2 foo
3 ..
4 .rm de
5 .de B
6 bar
7 ..
8 .A
9 .B
10 .pl \n(nlu
$ ./build/test-groff -ww -T ascii EXPERIMENTS/remove-de-request.roff
troff:EXPERIMENTS/remove-de-request.roff:5: warning: macro 'de' not defined
troff:EXPERIMENTS/remove-de-request.roff:7: warning: macro '.' not defined
troff:EXPERIMENTS/remove-de-request.roff:9: warning: macro 'B' not defined
troff:EXPERIMENTS/remove-de-request.roff:10: warning: setting computed page
length 0u to device vertical motion quantum
bar foo
Because defining the `B` macro didn't work, its body was interpreted
immediately, and so "bar" precedes "foo" in the output. This would not
be the case if `de` were protected from removal.
This example also affords me the chance to point out something about my
recent arithmetic-refactoring change that led me to enforce a positive
page length. In some degenerate cases like the above, you'll get a
warning if you use "the old `.pl \n(nlu` trick".
In the foregoing, since only one output line is ever written, and it had
not yet broken due to length, the value of the `nl` register is still
zero at the time we invoke the `pl` request. (It is only reaching the
end of input that causes the "bar foo" output line to break, move the
vertical position downward, trigger (final) page ejection, and end text
processing.)
In my opinion, this is an acceptable diagnostic under the circumstances.
But I thought people might appreciate a heads-up about it.
Regards,
Branden
signature.asc
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- removing the `de` macro and the old ".pl \n(nlu" trick,
G. Branden Robinson <=