> It should be enough to just check that the line (otherwise not
> empty) begins with at least one space.
I've implemented this now. From groff.texinfo:
-- Request: .lsm macro
-- Register: \n[lsn]
-- Register: \n[lss]
Set a leading spaces trap. `gtroff' executes MACRO when it
encounters leading spaces in an input line; the implicit line break
which normally happens in this case is suppressed. A line
consisting of spaces only, however, is treated as an empty line,
possibly subject to an empty line macro set with the `blm' request.
Leading spaces are removed from the input line before calling the
leading spaces macro. The number of removed spaces is stored in
register `lsn'; the horizontal space which would be emitted if
there was no leading space macro is stored in register `lss'.
Note that `lsn' and `lss' are available even if no leading space
macro has been set.
Enjoy!
Werner