[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Warn about long lines

From: Alejandro Colomar
Subject: Re: Warn about long lines
Date: Sat, 27 Aug 2022 19:42:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2

Hi Ralph,

On 8/27/22 18:05, Ralph Corderoy wrote:
Hi Alejandro,

        | sed 's/\x1b\[[^@-~]*[@-~]//g' \

Out of interest, what's the sed(1) attempting to do?
(I know what it's doing.)

Lines with highlighting have more characters than visible. Of course, in my 80 limit, I only want to count visible ones, so I need to get rid of the highlighting. I started with using [[:print:]] in grep(1), but it also counted part of the multibyte sequences of the highlighting (i.e., it didn't count the character that introduced the escape sequence, but counted the rest; more or less, what you'd see if you run less without -R; e.g., '[1m'). So I used this, as a big cannon; probably shooting more than necessary; I wanted to make sure no traces remained.

grotty(1) doesn't decide where to split the line, it happens earlier
than that, so you want to affect groff(1).
- If it's groff, then use ‘-rLL=80n’; see groff_man(7).

Ahh, this is what I needed.  I sometimes struggle to understand how
groff divides the implementation.

That's part of the problem with groff(1) existing instead of users
learning the pipeline of constituent parts, what they do, and how they
communicate, e.g.

     pic | tbl | eqn -Tutf8 | troff -man -Tutf8 | grotty

Yep, I'm usually more friend of using the low-level commands instead of the wrapper. It helps me understand better what is going on. When building C programs, I normally run all stages of the compilation that I can separate as explicit separate steps in the Makefile.

That line will help.

Although in this case it's for running groff(1)'s warnings, for which I'll need to run groff(1).

Do I get the same warnings by passing -ww and -rCHECKSTYLE=3 to troff(1) and to groff(1)? or does groff(1) have extra warnings (maybe since it also has access to the tbl(1) input)?

The data between troff(1) and grotty(1), or any other post-processor,
is in groff_out(5) format and what marks to put where has already been
decided, fixing the line length.

The man macros realise the man command might be on a terminal of varying
width or producing ‘cat’ man pages for storage.  To allow the man
command to specify the line-length required, the man macro allows the LL
number register to override what length it would normally use for the
‘.ll’ command.  When the man command runs troff, it uses the -r option
to set the number register.

It doesn't seem like a man(7)-specific thing

It is.

I mean, when searching for an option that controls the line length,
I expect it to be a generic option that will be applicable to groff as
a whole

No, the page dimensions, etc., are set within the troff source and it's
up to that source to allow for external specification if required.  If a
document is written without specifying them then the defaults apply and
the user can override these by using one of the paper-size macro sets,
e.g. ‘-ma4’ for A4 paper from groff's a4.tmac.

     troff -ma4

Ahh, it makes sense: normally documents are designed to be rendered in a specific device and characteristics. It's only manual pages that are more generic in that regard, in that they are mostly read in terminals (not their original conception, but that's what it is right now).

I searched for /column /length /width in groff(1) and found nothing. :/

groff(1) is a confusing front-end program for the normal troff-based
pipeline so some more interesting options would be in troff(1), for
example.  But in this case, it's not a command-line option.  :-)



Alejandro Colomar

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]