bugGNU troff - Bugs: bug #55320, [PATCH] tmac/an-old.tmac: Add a...

 
 

bug #55320: [PATCH] tmac/an-old.tmac: Add a warning about a missing .RS or an extra .RE

Submitted by:  Bjarni Ingi Gislason <bjarniig>
Submitted on:  Sat 29 Dec 2018 02:24:59 AM UTC  
 
Category:  Macro - man Severity:  1 - Wish
Item Group:  New feature Status:  Confirmed
Privacy:  Public Assigned to:  G. Branden Robinson <gbranden>
Open/Closed:  Open Planned Release:  None

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 21 Oct 2020 07:25:26 AM UTC, comment #1: 

I disagree with the precise wording of the proposed diagnostic message but broadly I think this is a good idea.  The logic seems okay, too.  I'll have to test it but it looks like it should behave correctly with a combination of argument-ful and argument-less calls to .RE.  (IIRC, Bjarni, like me, prefers only to call .RE without arguments--but we have to support those who supply them.)

We now have an an-warn macro, so the implementation should use it.

G. Branden Robinson <gbranden>
Project AdministratorIn charge of this item.
Sat 29 Dec 2018 02:24:59 AM UTC, original submission:  

From fc9d7995ce3456f5b568ae72605626320c6c2017 Mon Sep 17 00:00:00 2001
From: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Date: Sat, 29 Dec 2018 02:16:09 +0000
Subject: [PATCH] tmac/an-old.tmac: Add a warning about a missing .RS or an
 extra .RE

  See bug 55319, 'grog.1.man: Fix spelling and remove excess ".RE" lines'.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 tmac/an-old.tmac | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/tmac/an-old.tmac b/tmac/an-old.tmac
index e01c49b1..090b04b5 100644
--- a/tmac/an-old.tmac
+++ b/tmac/an-old.tmac
@@ -616,7 +616,10 @@
.  ft R
..
.
+.\" To check closure of the macro block (end with .RE)
+.nr an-RS-open 0
.de1 RS
+.  nr an-RS-open +1
.  nr an-saved-margin\\n[an-level] \\n[an-margin]
.  nr an-saved-prevailing-indent\\n[an-level] \\n[an-prevailing-indent]
.  ie \\n[.$] .nr an-margin +(n;\\$1)
@@ -627,12 +630,20 @@
..
.
.de1 RE
-.  ie \\n[.$] .nr an-level ((;\\$1) <? \\n[an-level])
-.  el         .nr an-level -1
-.  nr an-level (1 >? \\n[an-level])
-.  nr an-margin \\n[an-saved-margin\\n[an-level]]
-.  nr an-prevailing-indent \\n[an-saved-prevailing-indent\\n[an-level]]
-.  in \\n[an-margin]u
+.  ie \\n[an-RS-open]<=0 \{\
+.    tmc \\*[an-old]: \\n[.F]:\\n[.c] (.\\$0): warning: extra .\\$0 or
+.    tm1 " .RS is missing before it; "an-RS-open" is \\n[an-RS-open].
+.    tm1 "  This macro call is turned into a no-operation call (no op).
+.  \}
+.  el \{\
+.    nr an-RS-open -1
+.    ie \\n[.$] .nr an-level ((;\\$1) <? \\n[an-level])
+.    el         .nr an-level -1
+.    nr an-level (1 >? \\n[an-level])
+.    nr an-margin \\n[an-saved-margin\\n[an-level]]
+.    nr an-prevailing-indent \\n[an-saved-prevailing-indent\\n[an-level]]
+.    in \\n[an-margin]u
+.  \}
..
.
.\" table support
--
2.19.2

Bjarni Ingi Gislason <bjarniig>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Posted a comment)
  • -email is unavailable- added by bjarniig (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-10-21 gbranden Severity3 - Normal => 1 - Wish
        StatusNone => Confirmed
        Assigned toNone => gbranden
    2020-10-13 barx Carbon-CopyRemoved 93119 => -
    2020-10-13 barx Summarytmac/an-old.tmac: Add a warning about a missing .RS or an extra .RE => [PATCH] tmac/an-old.tmac: Add a warning about a missing .RS or an extra .RE

    Back to the top


    Powered by Savane 3.5