From b4bd6fb2b86072ab8c7da6dfdc93f13c67787009 Mon Sep 17 00:00:00 2001 From: "G. Branden Robinson" Date: Fri, 6 Feb 2026 09:02:42 -0600 Subject: [PATCH] Guidebook: Improve package loading for groff 1.24 groff 1.24 is in its second release candidate of this writing and features a noteworthy revision to its syntax. ---snip--- NEWS: * If your roff(7) documents follow any of the requests ... `so`, ... with a comment after their file name argument, and did not place that comment immediately after the file name, you are likely to get a diagnostic message resembling the following. warning: cannot open macro file 'e.tmac ': No such file or directory Or, less likely, the formatter will open the wrong file, one with spaces at the end of its name. That is because these requests are now able to process file names containing space characters. (This change also makes the request syntax consistent with that of `ds`, `as`, and others.) A quick fix is to place the comment escape sequence as early as possible. For example, we would change: .mso e.tmac \" Load Eric Allman's package. to: .mso e.tmac\" Load Eric Allman's package. to tell the formatter to load the "e.tmac" file rather than "e.tmac ". See the items below for further details. ---end snip--- Work around this change while maintaining with older groff and other *roff formatters. 1. Stop using space to separate comments from the argument to `so`. 2. Temporarily define a `So` macro to wrap the `soquiet` request (for groff 1.23 and later) or `so` request (for everything else). 3. Abort formatting with an error diagnostic if the `nh` macro package the Guidebook requires cannot be located. Fixes: $ (cd doc && rm -f Guidebook && make Guidebook) troff::34: error: cannot open 'tmac.nh ': No such file or directory troff::35: error: cannot open 'doc/tmac.nh': No such file or directory --- doc/Guidebook.mn | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index a8f739d5a..89f581285 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -31,8 +31,21 @@ .lt 70n .\} . -.so tmac.nh \" extra macros which aren't in tmac.n -.if !\n(nH .so doc/tmac.nh +.\" Load extra macros that "tmac.n" doesn't define. +.de So +.ie \n(.g&(\n(.x=1)&(\n(.y>22) .soquiet \\$1 +.el .so \\$1 +.. +. +.So tmac.nh +.if !\n(nH So doc/tmac.nh +. +.if !\n(nH \{\ +.tm fatal error: cannot locate "tmac.nh" macro package +.ab +.\} +. +.rm So . .\" building Guidebook.txt doesn't have CR font available; groff 1.23 issues .\" a warning each time any font can't be loaded; earlier versions silently