From ade0c02b20933618f650ba3e1f4ac83d9e911fde Mon Sep 17 00:00:00 2001 From: "G. Branden Robinson" Date: Tue, 10 Sep 2024 05:16:30 -0500 Subject: [PATCH] Make it easier for the Guidebook to find macros. * doc/Guidebook.mn: Make the Guidebook buildable from the top of the source tree, not just inside the "doc" directory. Try to load its "nh" macro package from the current working directory and from "doc". * doc/tmac.nh: Allocate new register `nH` to the purpose of detecting multiple loads, and skip file content if detected. This is the 1970s nroff form of an "#include guard". groff's "an-ext.tmac" uses the same technique for portability. Also I removed a tab character. Per the groff Texinfo manual: One possibly irritating idiosyncrasy is that tabs should not be used to vertically align comments in the source document. Tab characters are not treated as separators between a request name and its first argument, nor between arguments. Here's an example of how one groff macro package works around the problem. $ sed -n '402,406p' contrib/mm/m.tmac .ds LetCN CONFIDENTIAL\" Confidential default .ds LetSA To Whom It May Concern:\" Salutation default .ds LetAT ATTENTION:\" Attention string .ds LetSJ SUBJECT:\" Subject string .ds LetRN In reference to:\" Reference string --- doc/Guidebook.mn | 3 ++- doc/tmac.nh | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 319f31502..67ad5dbb6 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -31,7 +31,8 @@ .lt 70n .\} . -.so tmac.nh \" extra macros which aren't in tmac.n +.so tmac.nh \" extra macros which aren't in tmac.n +.if !\n(nH .so doc/tmac.nh . .\" 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 diff --git a/doc/tmac.nh b/doc/tmac.nh index 1a7ae1231..d4dd18a11 100644 --- a/doc/tmac.nh +++ b/doc/tmac.nh @@ -8,6 +8,10 @@ .\" cluttered as their number increased. It now uses the '.so' directive .\" to include this file. (tmac.n is passed to 'roff on the command line.) . +.\" Protect against being sourced twice. +.nr nH +1 +.if \n(nH>1 .nx +. .\" labeled paragraph start .\" .PS word .\" set the width for the label column