Update of bug #67448 (group groff): Category: None => Macro package - others/general Item Group: None => Incorrect behaviour Status: None => Need Info Summary: [PATCH] [tmac] aandoc.tmac: add sourcing "an.tmac" earlier to have used variables in a defined state => [tmac] andoc.tmac: add sourcing "an.tmac" earlier to have used variables in a defined state
_______________________________________________________ Follow-up Comment #1: [comment #0 original submission:] > From 2b3d8c50f8a1609a6e42a5b569ae65e1b17b0b7f Mon Sep 17 00:00:00 2001 > From: Bjarni Ingi Gislason <bjarn...@simnet.is> > Date: Thu, 21 Aug 2025 00:14:41 +0000 > Subject: [PATCH] [tmac] andoc.tmac: add sourcing "an.tmac" earlier to have > used variables in a defined state > > Directory: tmac > > Test file: > > .\" From gawk(1) > .if !\w@\*(lq@ \{\ > . tm String lq is empty > .\} That's not what's actually in the gawk.1 file in its [https://cgit.git.savannah.gnu.org/cgit/gawk.git/tree/doc/gawk.1 source distribution]. > Signed-off-by: Bjarni Ingi Gislason <bjarn...@simnet.is> > --- > tmac/andoc.tmac | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/tmac/andoc.tmac b/tmac/andoc.tmac > index cbfebac57..1c9fd9f21 100644 > --- a/tmac/andoc.tmac > +++ b/tmac/andoc.tmac > @@ -27,6 +27,10 @@ > .do nr *groff_andoc_tmac_C \n[.cp] > .cp 0 > . > +.\" Include "an.tmac" early to get those variables defined, > +.\" that are used before the macro TH is called. > +.mso an.tmac > +. > .als andoc-em em > .als andoc-bp bp > .als andoc-ne ne I suspect this will break other things. Did you run _groff_'s test suite after applying this change? Arnold's technique is not guaranteed to work with _groff_. This is not a recent development; as far as I know, "andoc.tmac" has always worked with _groff_'s "an.tmac" (formerly "an-old.tmac") and "doc.tmac" such that page-local definitions must follow the `TH` call (or `Dd`). _groff_man_(7): /.../share/groff/1.23.0/tmac/andoc.tmac This brief groff program detects whether the man or mdoc macro package is used by a document and loads the correct macro definitions, taking advantage of the fact that pages using them must call TH or Dd, respectively, before any other macros. A man program or a user typing, for example, “groff -mandoc page.1”, need not know which package the file page.1 uses. Multiple man pages, in either format, can be handled; andoc reloads each macro package as necessary. Page‐local redefinitions of names used by the man or mdoc packages prior to TH or Dd calls are “clobbered” by the reloading process. If you want to provide your own definition of an extension macro to ensure its availability, the an-ext.tmac entry below offers advice. This is not new advice. Here's what _groff_man_(7) from _groff_ 1.22.3 (November 2014) says: an‐ext.tmac The extension macro definitions for .SY, .OP, .YS, .TQ, .EX/.EE, .UR/.UE, and .MT/.ME are contained in this file. It is written in classic troff, and released for free re‐ use, and not copylefted; manual page authors concerned about portability to legacy Unix systems are encouraged to copy these definitions into their pages, and maintainers of troff or its workalikes are encouraged to re‐use them. Note that the definitions for these macros are read after the call of TH, so they will replace macros of the same names given at the beginning of your file. If you must use your own definitions for these macros, they must be given after calling TH. The advice is more general now, but I haven't substantially changed how "andoc.tmac" works (and I don't plan to). So unless you can explain to me how there is a defect here, I'll be closing the report as invalid. _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?67448> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
signature.asc
Description: PGP signature