At 2020-05-04T18:15:10-0400, Steve Izma wrote: > On Tue, May 05, 2020 at 07:59:45AM +1000, G. Branden Robinson wrote: > > Subject: Re: Why does simply creating a diversion produce output? > > > > > > .di d > > > > foo > > > > .di > > > > .rm d > > > > > > Output is only sent to the diversion when a break occurs, either > > > explicitly with .br, or when enough text has been collected to > > > fill a line, or in no-fill mode. Otherwise, the diversion remains > > > empty, but a partially collected line exists when the end of input > > > is encountered. > > > > I think I'd like to add that first sentence to the Texinfo manual > > and groff(7). At present, the Texinfo manual simply says, "The > > current partially filled line is included in the diversion." > > This refers to any partially filled line occurring before the > diversion starts (i.e., at the time of encountering the ".di d").
I'm not rushing to change the docs about this yet. When I feel at one with the subject, I'll be confident enough to share a patch post with the list, or I'll have a pile of example cases to prove my every claim. ;-) > In my experience I use diversions most often when I need to measure > the size of the output of the contents of the diversion. Then I can > decide if the diversion fits in a particular place on the page, then > move to that place and output the diversion's contents. > > In order to prevent partially filled lines going in at the beginning > of the diversion, I normally begin a new environment at the start of > the diversion. An alternative is to use .box instead of .di. Yes--the examples distinguishing .di and .box in the Texinfo manual are useful in this respect. The part I'm trying to get crystallized in my mind is where the output node comes from when I define a diversion and then wind up not using it. I now have a mental state machine that accounts for what groff actually does in the 3 cases at issue in this thread (and the irrelevance of deleting the diversion), but it still feels fragile. Regards, Branden
signature.asc
Description: PGP signature