bugGNU roff - Bugs: bug #55320, [man] warning about a missing .RS...

 
 

bug #55320: [man] warning about a missing .RS or an extra .RE

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Sat 29 Dec 2018 02:24:59 AM UTC
   
 
Category:  Macro man Severity:  1 - Wish
Item Group:  Warning/Suspicious behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 05 Mar 2022 10:23:20 PM UTC, comment #6: 

Patch was rejected, but the request was implemented.

G. Branden Robinson <gbranden>
Group administrator
Thu 28 Jan 2021 09:12:11 AM UTC, comment #5: 

comment #3:

>   A fix to report excessive number of '.RS' calls is still missing.
>


I don't understand the style problem you're talking about, and cannot see any evidence of it in bug #55319 (referenced in the original report) either.

What does it mean to have "excessive" .RS calls?

A person can nest as many .RS relative indents as they like, and thanks to negative or zero indent values, the cumulative indentation amount need not even be strictly increasing.

The relative inset level is reset to 1 by the .SH and .SS macros.  It is not necessary to "close off" each .RS with an .RE; in fact, it's not necessary to pair any .RS call with an .RE.  This behavior is compatible with the V7 man macros, and is documented in our groff_man(7) page and at great length in groff_man_style(7).

Am I misunderstanding you?

G. Branden Robinson <gbranden>
Group administrator
Thu 28 Jan 2021 08:59:51 AM UTC, comment #4: 

I believe I addressed this.


commit 254b6aa0a2233e603144d515b35e79bd5c0497b3
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Wed Jan 20 00:44:27 2021 +1100

    tmac/an-old.tmac (RE): Add style warnings.

    * tmac/an-old.tmac (RE): Style-warn if macro arguments are out of range
      or redundant.

    Fixes <https://savannah.gnu.org/bugs/?55320>.

    Tested with:
            .TH foo 1 "groff experiments" 2021-01-19
            .RE 1
            .RE 2
            .RE 0
            .RE
            .RS
            .RE


G. Branden Robinson <gbranden>
Group administrator
Wed 27 Jan 2021 11:39:57 PM UTC, comment #3: 

  A fix to report excessive number of '.RS' calls is still missing.

Bjarni Ingi Gislason <bjarniig>
Wed 20 Jan 2021 03:02:34 AM UTC, comment #2: 

I have my own fix for this ready to push.


diff --git a/tmac/an-old.tmac b/tmac/an-old.tmac
index b7781eca..ba1ad64f 100644
--- a/tmac/an-old.tmac
+++ b/tmac/an-old.tmac
@@ -579,6 +579,21 @@
 ..
 .
 .de1 RE
+.  ie \\n[.$] .nr an-RE-requested-level \\$1
+.  el         .nr an-RE-requested-level (\\n[an-level] - 1)
+.  ie \\n[.$] \{\
+.    if (\\n[an-RE-requested-level] = \\n[an-level]) \
+.      ds an-RE-problem redundant; already at level \\n[an-level]\"
+.    if (\\n[an-RE-requested-level] > \\n[an-level]) \
+.      ds an-RE-problem too large\"
+.    if (\\n[an-RE-requested-level] < 1) \
+.      ds an-RE-problem too small\"
+.    if d an-RE-problem \
+.      an-style-warn argument """\\$1""" to .\\$0 \\*[an-RE-problem]
+.    rm an-RE-problem
+.  \}
+.  el .if !(\\n[an-RE-requested-level]) .an-style-warn unbalanced .\\$0
+.  rr an-RE-requested-level
 .  ie \\n[.$] .nr an-level ((;\\$1) <? \\n[an-level])
 .  el         .nr an-level -1
 .  nr an-level (1 >? \\n[an-level])


G. Branden Robinson <gbranden>
Group administrator
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>
Group administrator
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)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-03-05 gbranden Item GroupFeature change Warning/Suspicious behaviour
        Summary[PATCH] tmac/an-old.tmac: Add a warning about a missing .RS or an extra .RE [man] warning about a missing .RS or an extra .RE
    2021-01-28 gbranden StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2021-01-28 gbranden StatusIn Progress Need Info
        Planned ReleaseNone 1.23.0
    2021-01-20 gbranden StatusConfirmed In Progress
    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.13-3230.
    Corresponding source code