groff-commit
[Top][All Lists]
Advanced

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

[groff] 07/14: [mm]: Improve cover sheet diagnostics.


From: G. Branden Robinson
Subject: [groff] 07/14: [mm]: Improve cover sheet diagnostics.
Date: Fri, 6 Jan 2023 16:20:12 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit c83f8157c9d276416dc29d650e15dcef57df4d8e
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Jan 3 16:02:02 2023 -0600

    [mm]: Improve cover sheet diagnostics.
    
    * m.tmac (MT): Warn and ignore if `COVER` or self already called.
    
      (COVER): Warn and ignore if `MT` already called.
    
    * mm/0.MT (cov@print-title): Abort if title not defined; tell user how
      to use the macros.
    
      (cov@print-authors): Add similar paranoid diagnostic that I don't
      think is reachable (since you _have_ to call `AU` to "close" `TL`).
    
    * mm/4.MT (cov@print-title, cov@print-authors):
    * mm/5.MT (cov@print-title): As "0.MT".
    
    * mm/4.MT: Get rid of spurious blank line in file.
    
    Also update editor aid comments; drop old style Emacs file-local
    variable setting.
    
    Also clarify a code comment.
---
 contrib/mm/ChangeLog | 17 +++++++++++++++++
 contrib/mm/m.tmac    | 14 +++++++++++++-
 contrib/mm/mm/0.MT   |  3 +++
 contrib/mm/mm/4.MT   | 12 +++++++++---
 contrib/mm/mm/5.MT   |  9 +++++++--
 5 files changed, 49 insertions(+), 6 deletions(-)

diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index 7044dce62..597c3c972 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,20 @@
+2023-01-03  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       Improve cover sheet diagnostics.
+
+       * m.tmac (MT): Warn and ignore if `COVER` or self already
+       called.
+       (COVER): Warn and ignore if `MT` already called.
+       * mm/0.MT (cov@print-title): Abort if title not defined; tell
+       user how to use the macros.
+       (cov@print-authors): Add similar paranoid diagnostic that I
+       don't think is reachable (since you _have_ to call `AU` to
+       "close" `TL`).
+       * mm/4.MT (cov@print-title, cov@print-authors):
+       * mm/5.MT (cov@print-title): As "0.MT".
+
+       * mm/4.MT: Get rid of spurious blank line in file.
+
 2023-01-03  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        Fix Savannah #63613.
diff --git a/contrib/mm/m.tmac b/contrib/mm/m.tmac
index cf9d9da53..dca8ccc69 100644
--- a/contrib/mm/m.tmac
+++ b/contrib/mm/m.tmac
@@ -3097,7 +3097,7 @@ in=\\n[.i] fi=\\n[.u] .d=\\n[.d] nl=\\n[nl] pg=\\n[%]
 .\" switch to ISO-date if register Iso exist: YYYY-MM-DD
 .if r Iso .ISODATE 1
 .\"-------------------
-.\" save technical numbers.
+.\" Save technical memorandum numbers.
 .de TM
 .nr cov*i 0 1
 .while \\n[.$]>=\\n+[cov*i] .ds cov*mt-tm!\\n[cov*i] \\$[\\n[cov*i]]
@@ -3118,6 +3118,14 @@ in=\\n[.i] fi=\\n[.u] .d=\\n[.d] nl=\\n[nl] pg=\\n[%]
 .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
+.\}
 .ie \\n[.$] \{\
 .      ie d cov*mt-file!\\$1 .ds cov*mt-type \\$1
 .      el .ds cov*mt-type 6
@@ -3130,6 +3138,10 @@ in=\\n[.i] fi=\\n[.u] .d=\\n[.d] nl=\\n[nl] pg=\\n[%]
 .mso \\*[cov*str]\\*[cov*mt-file!\\*[cov*mt-type]]
 ..
 .de COVER
+.if d cov*mt-type \{\
+.      @warning \\$0: ignoring; already using MT macro
+.      return
+.\}
 .ie !\\n[.$] .ds cov*cov-type ms
 .el .ds cov*cov-type \\$1
 .pg@disable-top-trap
diff --git a/contrib/mm/mm/0.MT b/contrib/mm/mm/0.MT
index 51ce71644..3426047b6 100644
--- a/contrib/mm/mm/0.MT
+++ b/contrib/mm/mm/0.MT
@@ -26,6 +26,7 @@ http://savannah.gnu.org/bugs/?group=groff.
 .if !r Au .nr Au 1
 .nr cov*mt0-ind 1.1c
 .de cov@print-title
+.if !d cov*title .@error title not defined; call TL and AU before MT
 .MOVE 4.8c 1.5c
 .S 8
 subject:
@@ -45,6 +46,8 @@ subject:
 ..
 .\"------------
 .de cov@print-authors
+.\" The following diagnostic might be unreachable.
+.if !r cov*au .@error no authors defined; call AU before MT
 .MOVE 5.7c 13.3c
 .nf
 .S 8
diff --git a/contrib/mm/mm/4.MT b/contrib/mm/mm/4.MT
index 8a1cdaffd..1fd31dfd7 100644
--- a/contrib/mm/mm/4.MT
+++ b/contrib/mm/mm/4.MT
@@ -1,4 +1,3 @@
-.\" -*- nroff -*-
 .ig
 
 Copyright (C) 1991-2020 Free Software Foundation, Inc.
@@ -25,7 +24,7 @@ http://savannah.gnu.org/bugs/?group=groff.
 .\" Cover sheet. Memorandum type 4
 .\"------------
 .de cov@print-title
-.if !d cov*title .@error title (.TL) not defined!
+.if !d cov*title .@error title not defined; call TL and AU before MT
 .MOVE 2.8c
 .S +2
 .ad c
@@ -39,6 +38,8 @@ http://savannah.gnu.org/bugs/?group=groff.
 ..
 .\"------------
 .de cov@print-authors
+.\" The following diagnostic might be unreachable.
+.if !r cov*au .@error no authors defined; call AU before MT
 .SP 0.5
 .I
 .S +1
@@ -101,4 +102,9 @@ http://savannah.gnu.org/bugs/?group=groff.
 .cov@print-firm
 .cov@print-abstract
 ..
-
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 72
+.\" End:
+.\" vim: set filetype=groff textwidth=72:
diff --git a/contrib/mm/mm/5.MT b/contrib/mm/mm/5.MT
index 8882bf9fc..2748a7774 100644
--- a/contrib/mm/mm/5.MT
+++ b/contrib/mm/mm/5.MT
@@ -1,4 +1,3 @@
-.\" -*- nroff -*-
 .ig
 
 Copyright (C) 1991-2020 Free Software Foundation, Inc.
@@ -26,7 +25,7 @@ http://savannah.gnu.org/bugs/?group=groff.
 .\"------------
 .nr cov*mt0-ind 1.1c
 .de cov@print-title
-.if !d cov*title .@error title (.TL) not defined!
+.if !d cov*title .@error title not defined; call TL and AU before MT
 .B
 .ll 9c
 .fi
@@ -55,3 +54,9 @@ http://savannah.gnu.org/bugs/?group=groff.
 .      pg@enable-trap
 .      ds cov*mt-printed
 .\}
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 72
+.\" End:
+.\" vim: set filetype=groff textwidth=72:



reply via email to

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