Proposed: make `pwh` request (formerly `ptr`) report diversion traps

"G. Branden Robinson" <[email protected]> Tue, 19 May 2026 17:06:16 -0500
Newsgroups gmane.comp.printing.groff.general
Message-ID <20260519220616.bqeoiu6za75e2zij@illithid>
Hi folks,

I have a hunch that this feature change is sufficiently useful,
harmless, and esoteric that I've gone ahead and implemented it, but not
yet pushed it.

As you may know, the `pwh` request (called `ptr` in groff 1.23 and
earlier) reports the set of page location traps (if any) to the standard
error stream.

However, a diversion trap is a different thing.

https://www.gnu.org/software/groff/manual/groff.html.node/Diversion-Traps.html

"Regular" traps--page location traps--are properties of the top-level
diversion.  They are mutually exclusive with diversion traps, of which
each "macro diversion"--any diversion but the top-level diversion--can
have at most one each.

I filed Savannah #68358 when I noticed that it's unreasonably hard to
introspect the presence of a diversion trap.

https://savannah.gnu.org/bugs/?68358

The proposed behavior change is to make `pwh` report the properties of a
diversion trap if one is present, instead of reporting nothing.

Another possible solution would be to implement a new request called
"pdt" to report this information, but, to me, the mutual exclusivity of
page location and diversion traps, and the desirability of not further
growing the request repertoire unnecessarily argued against it.  It's
won't be difficult to change the code to hook this feature up to a new
"pdt" request instead of "pwh" if people would prefer that.  (In a
sense, that would be the more "orthogonal" solution.)

I do have a moderately strong feeling that the report should be
available via _some_ means.

Thoughts?  Objections?  Please follow-up here or to the aforementioned
Savannah ticket.

Regards,
Branden
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmoM3s8ACgkQ0Z6cfXEm
bc5KYhAAm0BRUVKuhmFFCmnJf69GJ0NocMXH4YYtTrz62NF+0xXiLxB1ZZj9g0OD
H8O6QBFWVZNj7WLbsxUoKjIjdu/lTQD6bw8X4Z1gXG4ffPuKZsvsv4ryglNFcOAi
nlAt7q6n1oz2/Fd3ETOrA3lTWSGsWz0v5DSeo09EFpB+dOIT88ViV6egLtS8tk4d
k6Z2sZTYclXiEXCCi29l2sB94P8ucawBojY8nSlJCToWpzBv8BG2zxoU1tVjx5D5
7W0rmrBEk2W/ahrNkct+D1V93nXCg730rngyLpbm3THIYGiHEWMeCVWZO3L0nXYd
U72Pl8KxT/Obefer6mHlhI2vloAaCqvty1Jtgno8+3fR5k8rXkGzVRSXEoxUnc9q
bq8J+OnvV94DyvgZSRh69SaA4Of/+9SRQTg38wC+eRAQ3E+WokvA7oRqY9RxV5q+
T2qh1Miiv98sGRWZ6jLP9YMq6tkwjebP8IoPfXJLi+B3zzE1GerlicLTXxnXbdlO
bVKoisqb3xtUvpJo+ttFBYq4lhe6T+C+a9kMEMXIL4SUXcZwM6999rYhdo3WTWKu
bk1bVofnw1tlknSmsae4iRmAwJiX6srtboJicnKP8I3sHcrcaYbuyASIGG8a6kv/
jUbRRDezcQ/mlWrnLK2RvrTRo/W/0+y1v3ho0cUFhTYWONnGQOg=
=CKXh
-----END PGP SIGNATURE-----