gbranden pushed a commit to branch master
in repository groff.

commit 73262611515d7955bd520bac7f3c28f119f0519d
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Aug 21 19:29:53 2025 -0500

    [hdtbl]: Add error checking to initial load.
    
    * contrib/hdtbl/hdtbl.tmac: Diagnose and skip loading the package in
      situations that would cause it to malfunction.
        - if the formatter does not claim groff compatibility
        - if the formatter is in groff's AT&T compatibility mode
        - if a macro named `TD` is already defined
        - if a macro named `TH` is already defined
        - if a macro named `TR` is already defined
    
    Fixes <https://savannah.gnu.org/bugs/?67418>.  Thanks to Morten Bo
    Johansen for the report.
---
 contrib/hdtbl/ChangeLog  | 13 +++++++++++++
 contrib/hdtbl/hdtbl.tmac | 29 +++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/contrib/hdtbl/ChangeLog b/contrib/hdtbl/ChangeLog
index 57e1c1341..850ae3173 100644
--- a/contrib/hdtbl/ChangeLog
+++ b/contrib/hdtbl/ChangeLog
@@ -1,3 +1,16 @@
+2025-08-21  G. Branden Robinson <[email protected]>
+
+       * hdtbl.tmac: Diagnose and skip loading the package in
+       situations that would cause it to malfunction.
+       - if the formatter does not claim groff compatibility
+       - if the formatter is in groff's AT&T compatibility mode
+       - if a macro named `TD` is already defined
+       - if a macro named `TH` is already defined
+       - if a macro named `TR` is already defined
+
+       Fixes <https://savannah.gnu.org/bugs/?67418>.  Thanks to Morten
+       Bo Johansen for the report.
+
 2025-08-20  G. Branden Robinson <[email protected]>
 
        * hdtbl.tmac: Define new `hdtbl` string containing the
diff --git a/contrib/hdtbl/hdtbl.tmac b/contrib/hdtbl/hdtbl.tmac
index 9504a5112..359a4cc8d 100644
--- a/contrib/hdtbl/hdtbl.tmac
+++ b/contrib/hdtbl/hdtbl.tmac
@@ -2,6 +2,7 @@
 This file is part of groff, the GNU roff typesetting system.
 
 Copyright (C) 2005-2020 Free Software Foundation, Inc.
+              2025 G. Branden Robinson
 written by Joachim Walsdorff <[email protected]>.
 
 groff is free software; you can redistribute it and/or modify it under
@@ -24,11 +25,39 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .\"    *                       Vers. 0.91 December 2005                *
 .\"    *****************************************************************
 .
+.if !\n(.g \{\
+.  tm groff hdtbl macros require groff extensions; cannot load package
+.  nx
+.\}
+.
+.if \n(.C \{\
+.  tm groff hdtbl macros do not work in compatibility mode; cannot \
+load package
+.\}
+.
 .if d TBL \
 .  nx
 .
 .ds hdtbl hdtbl.tmac\"
 .
+.\" Check for name space collisions with full-service macro packages.
+.
+.if d TD \{\
+.  tm \*[hdtbl]: cannot load package; macro 'TD' is already defined
+.  nx
+.\}
+.
+.if d TH \{\
+.  tm \*[hdtbl]: cannot load package; macro 'TH' is already defined
+.  nx
+.\}
+.
+.if d TR \{\
+.  tm \*[hdtbl]: cannot load package; macro 'TR' is already defined
+.  nx
+.\}
+.
+.
 .mso hdmisc.tmac
 .mso 62bit.tmac
 .

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to