diff --git a/ChangeLog b/ChangeLog index bb891530..02792450 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,56 @@ +2020-08-22 G. Branden Robinson + + Drop the .ll hack for setting the line length on nroff devices. + + Once upon a time, the only way to get man pages to render on a + terminal at any width other than the nroff default of 65n was to + put an .ll request into the page--or your man pager could sneak + such a request into nroff's input stream. Also, in times long + passed, John Eaton of UT Austin wrote a man(1) program. In a + few years this implementation branched into two lines of + development, which I'll call man-db man (Wilford/Polacco/Watson) + and another, Brouwer/Lucifredi man, which as of this writing saw + its last release in 2011 (1.6g). + + The man macros of groff 1.18 (July 2002) featured an LL register + for configuring the line length which respected an -rLL + command-line option. The source change was made by Werner + Lemberg on 3 May 2002 and Colin Watson updated man-db man(1)--on + the same day!--to support it. For compatibility with other + implementations, possibly Brouwer/Lucifredi man, any existing + .ll setting (technically, value of \n[.l], the only way this + value can be introspected) was still respected--usually--if LL + was not set. It is impossible to distinguish a user-supplied + ".ll 65n" setting from nroff's default setting, which was in + that case overridden to the modern default of 78n. This led to + {1} suprising behavior for users accustomed to old methods and + desirous of the nroff default and {2} lengthy apologia in groff + source code comments. + + Let us survey the field in 2020. man-db man has supported the + LL register for 18 years. Heirloom Doctools's man macros set + the line length to 78n on nroff devices unconditionally. + mandoc(1) similarly also always formats for 78 columns on + terminals. By its 1.6 release (20 June 2005), Brouwer/Lucifredi + man had also started using the LL register. + + There no longer seems to be any reason to preserve this hack. + + * tmac/an-old.tmac (initialization): Drop complex set up of LL + register. + (TH): Relocate line length reset; no behavior change. + (after .mso man.local): Initialize LL if the user hasn't. + Otherwise, use device default in troff mode, and 78n in nroff + mode. + + * tmac/groff_man.7.man.in (Options) <-rLL>: Stop documenting the + .ll hack. + + * tmac/tests/an-old_init_LL_sanely.sh: Add test. + * tmac/tmac.am (tmac_TESTS): Run test. + + Fixes Savannah #58992. + 2020-08-22 G. Branden Robinson * tmac/tests/an-old_TH_repairs_ad_damage.sh: diff --git a/NEWS b/NEWS index f36585dc..917fd640 100644 --- a/NEWS +++ b/NEWS @@ -104,6 +104,13 @@ o The an (man) macro package supports new CS and CT number registers to implementations) a way to view the rendered page elements in full capitals if desired. +o The an (man) macro package no longer honors an .ll request to set the + line length in nroff devices prior to processing a man page. This was + deprecated 18 years ago, and all known man program and macro package + implementations either have set/respected an LL register since 2005 or + earlier (man-db man and Brouwer/Lucifredi man), or simply use a + non-configurable line length of 78n (mandoc, Heirloom Doctools). + o The groff_man(7) man page documenting the groff implementation of the man macro package has been split into two pages. The original page remains as a terser reference for experienced users. A new page, diff --git a/tmac/an-old.tmac b/tmac/an-old.tmac index 3d9e6cd7..c389fa04 100644 --- a/tmac/an-old.tmac +++ b/tmac/an-old.tmac @@ -55,30 +55,6 @@ .nr need_eo_h 0 .nr need_col2 0 . -.\" set up the line length... -.\" giving precedence to any prior assignment to the \n[LL] register. -.if !r LL \{\ -. -. \" but if that isn't predefined... -. \" then try to respect any prior '.ll' request. -. nr LL \n[.l] -. -. \" For troff, this is sufficient to give us a default line length of -. \" 6.5i, but for nroff, we prefer a default of 78n to nroff's default -. \" 65n. This has the unfortunate side effect that we will override a -. \" user's '.ll 65n' request, with our preferred 78n default; we can't -. \" possibly know that the 65n came from a '.ll' request, and MUST -. \" assume that it was set by nroff, as its built-in default! If the -. \" user wants to force this setting, then he MUST use the '-rLL=65n' -. \" option, or an equivalent '.nr LL 65n' request. -. if n \ -. if (\n[LL] = 65n) \ -. nr LL 78n -.\} -. -.if !r LT \ -. nr LT \n[LL] -. .nr FT (-.5i) . .nr an-first 1 @@ -159,11 +135,11 @@ . . ps \\n[PS]u . vs \\n[VS]u -. ll \\n[LL]u . . \" Restore parameters that a previous man page might have messed up. . ad \\*[AD] . hy \\n[HY] +. ll \\n[LL]u . .\" We must select an integer indentation value for nroff; .\" see comment in an-do-tag. @@ -694,6 +670,20 @@ . nr HY 6 .\} . +.\" Similarly for line length. +.if !r LL \{\ +. \" If in troff mode, respect device default. +. ie t \ +. nr LL \n[.l] +. \" Otherwise, override nroff mode default of 65n. +. el \ +. nr LL 78n +.\} +. +.\" Similarly for title length. +.if !r LT \ +. nr LT \n[LL]u +. .\" Set the default adjustment mode and heading font only if -d options .\" or man.local did not. .if !d AD \ diff --git a/tmac/groff_man.7.man.in b/tmac/groff_man.7.man.in index 90e0c78d..a871b695 100644 --- a/tmac/groff_man.7.man.in +++ b/tmac/groff_man.7.man.in @@ -3010,51 +3010,6 @@ Set line length; the default is 78n for terminal devices and 6.5i for typesetter devices. . -If this option is not given, -.\" Don't bold the .ll request in this discussion; it's not a major -.\" topic of _this_ page as it would be in groff(7). Also, we don't -.\" want to encourage people to mess with this old kludge by drawing -.\" attention to it. -the line length is set to respect any value set by a prior \(lq.ll\(rq -request -(which -.I must -be in effect when the -.B .TH -macro is invoked), -if this differs from the built-in default for the formatter. -. -. -.IP -Note that the use of an \(lq.ll\(rq request to initialize the line -length is supported for backward compatibility with some versions of -the -.I man -program; -direct initialization of the -.B LL -register should -.I always -be preferred to the use of such a request. -. -In particular, -note that an \(lq.ll\~65n\(rq request does -.I not -preserve the default -.I nroff -line length -(the -.I man -default initialization to 78n prevails), -whereas the -.B \-rLL=65n -option, -or an equivalent \(lq.nr\~LL\~65n\(rq request preceding the use of the -.B .TH -macro, -.I does -set a line length of 65n. -. . .TP .BI \-rLT= title-length diff --git a/tmac/tests/an-old_init_LL_sanely.sh b/tmac/tests/an-old_init_LL_sanely.sh new file mode 100755 index 00000000..12b24b1f --- /dev/null +++ b/tmac/tests/an-old_init_LL_sanely.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Copyright (C) 2020 Free Software Foundation, Inc. +# +# This file is part of groff. +# +# groff is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# groff is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +groff="${abs_top_builddir:-.}/test-groff" + +# Regression-test Savannah #58992. +# +# Our man macros should no longer attempt to read the .l register on +# nroff devices to set the line length. That register may or may not +# have been set by a user .ll request; we can't tell whether a value of +# 65n came from nroff or the user. +# +# Instead, the LL register must be used to set the line length. +# +# In this test we _expect_ the .ll request to be ignored and overridden. +# We choose a value that is not nroff's default nor man's default. + +EXAMPLE=' +.ll 70n +.TH ll\-hell 1 2020-08-22 "groff test suite" +.SH Name +ll\-hell \- see how long the lines are +.SH Description +LL=\n[LL]u +.PP +\&.l=\n[.l]u' + +printf "%s\n" "$EXAMPLE" | "$groff" -Tascii -P-cbou -man \ + | grep -q 'LL=1872u' + +# vim:set ai et sw=4 ts=4 tw=72: diff --git a/tmac/tmac.am b/tmac/tmac.am index 2e771609..73c047ec 100644 --- a/tmac/tmac.am +++ b/tmac/tmac.am @@ -142,8 +142,8 @@ EXTRA_DIST += \ tmac_TESTS = \ tmac/tests/an-ext_ME_punct_hyphenates.sh \ - tmac/tests/an-ext_UE_punct_hyphenates.sh \ tmac/tests/an-ext_MT_body_hyphenates.sh \ + tmac/tests/an-ext_UE_punct_hyphenates.sh \ tmac/tests/an-ext_UR_body_hyphenates.sh \ tmac/tests/an-old_AT_and_UC_footer_saved_and_restored.sh \ tmac/tests/an-old_CS_register_off.sh \ @@ -153,7 +153,8 @@ tmac_TESTS = \ tmac/tests/an-old_CT_register_on.sh \ tmac/tests/an-old_CT_register_unspecified.sh \ tmac/tests/an-old_TH_repairs_ad_damage.sh \ - tmac/tests/an-old_TH_repairs_hy_damage.sh + tmac/tests/an-old_TH_repairs_hy_damage.sh \ + tmac/tests/an-old_init_LL_sanely.sh TESTS += $(tmac_TESTS) tmac_XFAIL_TESTS = \