Hi Alex,

At 2025-08-15T11:24:06+0200, Alejandro Colomar wrote:
> On Tue, Aug 12, 2025 at 11:18:41AM +0200, Alejandro Colomar wrote:
> > The output looks like this:
> > 
> >     $ make lint-man-blank -R
> >     GREP ^$         .tmp/man/man7/bpf-helpers.7.lint-man.blank.touch
> >     .tmp/man/man7/bpf-helpers.7: spurious blank lines:
> >     548:
> >     552:
> >     555:
> >     3057:
> >     make: *** 
> > [/srv/alx/src/linux/man-pages/man-pages/contrib/share/mk/lint/man/blank.mk:22:
> >  .tmp/man/man7/bpf-helpers.7.lint-man.blank.touch] Error 1
> 
> Actually, this has some false positives in tbl code:
> 
>       $ grep -m1 -B3 -A8 ^$ man/man7/inode.7
>       .TS
>       lB l l.
>       S_IFMT  0170000 bit mask for the file type bit field
> 
>       S_IFSOCK        0140000 socket
>       S_IFLNK 0120000 symbolic link
>       S_IFREG 0100000 regular file
>       S_IFBLK 0060000 block device
>       S_IFDIR 0040000 directory
>       S_IFCHR 0020000 character device
>       S_IFIFO 0010000 FIFO
>       .TE
> 
> Is there a way to avoid these blanks in tbl code?

Certainly.  You can use the *roff dummy character `\&` to make the table
row non-blank according to the formatter.

This makes no difference even on typesetters, because the (default)
meaning of a blank input line is a 1v space on the output.  A text line
with only a dummy character on it behaves the same way.  Thus, I
wouldn't call these false positives, but true ones.*

$ printf 'foo\n.TS\nL.\n\n.TE\nbar\n' | groff -tZ > /tmp/blank
$ printf 'foo\n.TS\nL.\n\\&\n.TE\nbar\n' | groff -tZ > /tmp/dummy
$ diff -u /tmp/blank /tmp/dummy && echo SAME
SAME

In principle, we could change GNU tbl to _transform_ blank lines (inside
tbl regions only) to consist of only a dummy character and newline--that
should have zero impact on any document's formatting anywhere.

On the other hand, I think it might make more sense to leave things as
they are, and encourage a discipline of explicit `\&` usage.  The odds
of someone accidentally typing that digraph are vanishingly small,** and
in a tbl context (or any *roff scenario where filling is disabled) it is
easy to interpret as "I want a blank line here; I know what I'm doing".

Regards,
Branden

*   Recall that on typesetters, in man(7) and other full-service macro
    packages generally, the inter-paragraph space amount is _not_ 1v,
    but somewhat less.  If you want a break in your table, it's wise to
    be explicit about how big you want that break to be.  Sometimes you
    can use a package's paragraphing macros inside a tbl region, but no
    one guarantees this.  What you _can_ do is insert `sp` requests, and
    this seems to be a countenanced practice judging from documents I've
    seen prepared by seasoned practitioners.  On the third hand, that
    trick won't work in general in ".TS H/.TH" tables because they are
    formatted in diversions, where the rules about vertical spacing are
    different.***  And on the fourth hand, that doesn't matter for
    man(7) because it doesn't support ".TS H/.TH" tables anyway.  If
    it's ever going to, we'll need a synonym for tbl's ".TH" because
    that token collides with existing man(7) usage like the McLennan
    County locomotive crash of 1896.

**  contrast with the odds of accidentally--or, more likely,
    thoughtlessly--whacking the Enter key

*** 
https://www.gnu.org/software/groff/manual/groff.html.node/Manipulating-Spacing.html

Attachment: signature.asc
Description: PGP signature

Reply via email to