groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 07/33: [mm]: Help user navigate the document type macros.


From: G. Branden Robinson
Subject: [groff] 07/33: [mm]: Help user navigate the document type macros.
Date: Sun, 29 Jan 2023 19:35:25 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 7d3c27680d1e9f179b235df85e0bd4af9e56c579
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Jan 22 13:09:40 2023 -0600

    [mm]: Help user navigate the document type macros.
    
    * contrib/mm/m.tmac: Help user navigate the document type macros.  Stop
      setting up the formatter to throw "unrecognized macro"
      diagnostics for macros that are plainly documented in
      groff_mm(7).
    
      (@disable): New macro takes a list of macros whose definitions are
      replaced with a warning diagnostic about how they're no longer
      unavailable due to use of another document type macro already called,
      identified by new string `@cover`.
    
      (TL, MT, COVER, LT, LO): Define `@cover` and call `@disable`.  Drop
      existing diagnostics that did a similar thing as above, more
      verbosely.
---
 contrib/mm/ChangeLog | 14 ++++++++++++++
 contrib/mm/m.tmac    | 37 ++++++++++++++++++++++---------------
 2 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index b18a5536c..435023f9c 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,17 @@
+2023-01-22  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * m.tmac: Help user navigate the document type macros.  Stop
+       setting up the formatter to throw "unrecognized macro"
+       diagnostics for macros that are plainly documented in
+       groff_mm(7).
+       (@disable): New macro takes a list of macros whose definitions
+       are replaced with a warning diagnostic about how they're no
+       longer unavailable due to use of another document type macro
+       already called, identified by new string `@cover`.
+       (TL, MT, COVER, LT, LO): Define `@cover` and call `@disable`.
+       Drop existing diagnostics that did a similar thing as above,
+       more verbosely.
+
 2023-01-17  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * m.tmac: Revise diagnostic messages.  Use a consistent message
diff --git a/contrib/mm/m.tmac b/contrib/mm/m.tmac
index 6681c162b..22275c1e2 100644
--- a/contrib/mm/m.tmac
+++ b/contrib/mm/m.tmac
@@ -995,6 +995,18 @@ numeric; got '\\$1'
 .acc@under-def , \(ac
 .\" ######## module uni #################
 .\" unimplemented macros
+.de @disable
+.ds @end \" empty
+.while \\n[.$] \{\
+.      rm \\$1 \" in case it's aliased
+.      de \\$1 @end
+.              @warning \\$1: ignoring; unavailable after \\*[@cover]
+.      @end
+.      shift
+.\}
+..
+.rm @end
+.
 .de CS
 .@warning \\$0: not implemented except with ".MT 4"
 ..
@@ -3094,7 +3106,8 @@ exceeds depth of nested lists (\\n[li*lvl])
 .\"
 .nr cov*au 0
 .de TL
-.rm IA IE WA WE LO LT
+.ds @cover \\$0
+.@disable IA IE WA WE LO LT \" can't use with LT and friends
 .if \\n[.$]>0 .ds cov*title-charge-case \\$1
 .if \\n[.$]>1 .ds cov*title-file-case \\$2
 .pg@disable-top-trap
@@ -3204,14 +3217,8 @@ exceeds depth of nested lists (\\n[li*lvl])
 .ds cov*mt-file!6 0.MT
 .\"------------
 .de MT
-.if d cov*cov-type \{\
-.      @warning \\$0: ignoring; already using COVER macro
-.      return
-.\}
-.if d cov*mt-type \{\
-.      @warning \\$0: ignoring; type is already \\*[cov*mt-type]
-.      return
-.\}
+.ds @cover \\$0
+.@disable COVER IA IE WA WE LO LT
 .ie \\n[.$] \{\
 .      ie d cov*mt-file!\\$1 .ds cov*mt-type \\$1
 .      el .ds cov*mt-type 6
@@ -3224,10 +3231,8 @@ exceeds depth of nested lists (\\n[li*lvl])
 .mso \\*[cov*str]\\*[cov*mt-file!\\*[cov*mt-type]]
 ..
 .de COVER
-.if d cov*mt-type \{\
-.      @warning \\$0: ignoring; already using MT macro
-.      return
-.\}
+.ds @cover \\$0
+.@disable IA IE WA WE LO LT MT
 .ie !\\n[.$] .ds cov*cov-type ms
 .el .ds cov*cov-type \\$1
 .pg@disable-top-trap
@@ -3486,7 +3491,8 @@ undefined
 .\" let@header is called from the header. It is supposed
 .\" to remove the alias itself.
 .de LT
-.rm AF AS AE AT AU CS OK TL MT
+.ds @cover LT
+.@disable AF AS AE AT AU COVER CS OK TL MT \" same list as LO
 .ds let*type BL
 .nr Pi 5
 .nr Pt 0
@@ -3703,7 +3709,8 @@ undefined
 .\"-------------------
 .\" Letter options
 .de LO
-.rm AF AS AE AT AU CS OK TL MT
+.ds @cover \\$0
+.@disable AF AS AE AT AU COVER CS OK TL MT \" same list as LT
 .if !\\n[.$] \{\
 .      @warning \\$0: ignoring; no arguments specified
 .      return



reply via email to

[Prev in Thread] Current Thread [Next in Thread]