URL:
  <https://savannah.gnu.org/bugs/?67844>

                 Summary: [troff] support new `pdiv` request?
                   Group: GNU roff
               Submitter: gbranden
               Submitted: Sun 21 Dec 2025 06:43:11 PM UTC
                Category: Core
                Severity: 1 - Wish
              Item Group: Feature change
                  Status: Postponed
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Unlocked
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Sun 21 Dec 2025 06:43:11 PM UTC By: G. Branden Robinson <gbranden>
In the forthcoming _groff_ 1.24, we can dump a "macro diversion"'s contents.


$ printf '.box mydiv\nfoobar\n.br\n.box\n.pm mydiv\n' | ~/groff-HEAD/bin/groff
2>&1 | jq
{
  "name": "mydiv",
  "file name": "<standard input>",
  "starting line number": 1,
  "length": 10,
  "contents": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\n",
  "node list": [
    {
      "type": "output line start node",
      "diversion level": 0,
      "is_special_node": false
    },
    {
      "type": "glyph node",
      "diversion level": 0,
      "is_special_node": false,
      "character": "f"
    },
    {
      "type": "glyph node",
      "diversion level": 0,
      "is_special_node": false,
      "character": "o"
    },
    {
      "type": "glyph node",
      "diversion level": 0,
      "is_special_node": false,
      "character": "o"
    },
    {
      "type": "glyph node",
      "diversion level": 0,
      "is_special_node": false,
      "character": "b"
    },
    {
      "type": "glyph node",
      "diversion level": 0,
      "is_special_node": false,
      "character": "a"
    },
    {
      "type": "glyph node",
      "diversion level": 0,
      "is_special_node": false,
      "character": "r"
    },
    {
      "type": "vertical spacing node",
      "diversion level": 0,
      "is_special_node": false,
      "vunits": -12000
    },
    {
      "type": "vertical spacing node",
      "diversion level": 0,
      "is_special_node": false,
      "vunits": 0
    }
  ]
}


But I've noticed that diversions have a lot of properties besides "content".

https://cgit.git.savannah.gnu.org/cgit/groff.git/tree/src/roff/troff/div.h?h=1.23.0#n23
https://cgit.git.savannah.gnu.org/cgit/groff.git/tree/src/roff/troff/div.h?h=1.23.0#n70
https://cgit.git.savannah.gnu.org/cgit/groff.git/tree/src/roff/troff/div.h?h=1.23.0#n102

While some are exposed via read-only registers, others, like the "previous"
values of page offset and whatnot, aren't.

It might be nice to be able to get a synoptic view of a diversion's
properties--particularly the top-level diversion, which has no name and this
cannot be accessed via the `pm` request--similarly to the way the `pev` has
long let us inspect environments.

No immediate plans.  Born postponed.







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?67844>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to