groff
[Top][All Lists]
Advanced

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

[man-db, groff] I'd like to help kill off some man(1) hacks


From: G. Branden Robinson
Subject: [man-db, groff] I'd like to help kill off some man(1) hacks
Date: Sat, 22 Aug 2020 04:42:34 +1000
User-agent: NeoMutt/20180716

Hi Colin (and other man-db and groff hackers),

In man-db's src/man.c, we see the following:

2072 static void disable_hyphenation (void *data _GL_UNUSED)
2073 {
2074         fputs (".nh\n"
2075                ".de hy\n"
2076                "..\n"
2077                ".lf 1\n", stdout);
2078 }
2079
2080 static void disable_justification (void *data _GL_UNUSED)
2081 {
2082         fputs (".na\n"
2083                ".de ad\n"
2084                "..\n"
2085                ".lf 1\n", stdout);
2086 }

2195                 if (!recode && no_hyphenation) {
2196                         pipecmd *hcmd = pipecmd_new_function (
2197                                 "echo .nh && echo .de hy && echo ..",
2198                                 disable_hyphenation, NULL, NULL);
2199                         pipecmd_sequence_command (seq, hcmd);
2200                         ++prefixes;
2201                 }
2202
2203                 if (!recode && no_justification) {
2204                         pipecmd *jcmd = pipecmd_new_function (
2205                                 "echo .na && echo .de ad && echo ..",
2206                                 disable_justification, NULL, NULL);
2207                         pipecmd_sequence_command (seq, jcmd);
2208                         ++prefixes;
2209                 }

The above is to support the --nh and --nj options.

I've pushed some changes to groff's man macros that enable greatly
improved user control of adjustment and hyphenation.  However, it
interacts badly with the above because of the redefinition of the .hy
and .ad requests.

It should be possible in the future for man-db man, #ifdef
TROFF_IS_GROFF, to discard injection of requests into groff's input
stream in favor of simply calling it with options.

        man --nh -> groff -man -rHY=0
        man --nj -> groff -man -dAD=l

I get the feeling you'd have happily used these facilities if they
existed in 2008-2009 when you implemented the man(1) options.

What do you think?  No one has mentioned a release time table for groff
1.22.5, and Bertrand is pretty busy with life and fatherhood lately, so
there should be plenty of time to coördinate migration strategies.  I'm
also mindful of the possibility that it would suck for you to have to
query an installed groff for its version string, parse it, and adapt to
it, so I'm open to suggestions.

As you know, I'm a pretty stern prescriptivist in the man page
department and I don't think man pages should be making
{.ad,.hy,.na,.nh} requests at all, but even if they do I'd like to
update groff's TH macro to recover from the damage upon reading a new
page.  (Granted, multi-page rendering with one groff command may be not
all that common.  But I like it because it makes it easy to
regression-test my changes.)

Thoughts welcome from all man and groff mavens.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

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