bug-groff
[Top][All Lists]
Advanced

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

[bug #61710] [me] $v and $V are in the wrong namespace


From: G. Branden Robinson
Subject: [bug #61710] [me] $v and $V are in the wrong namespace
Date: Tue, 21 Dec 2021 11:51:58 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Update of bug #61710 (project groff):

                  Status:                    None => Need Info              
             Assigned to:                    None => gbranden               
                 Summary: $v and $V are in the wrong namespace => [me] $v and
$V are in the wrong namespace

    _______________________________________________________

Follow-up Comment #1:

[comment #0 original submission:]
> (This bug is sort of a counterpart to bug #61683 and a cousin to bug
#61314.)
> 
> The "me Reference Manual" says, "Registers and strings with names of the
form $x may be used in expressions and text but should not be changed."  For
most of them, this makes sense: they store values that are set by invoking
specific -me macros.
> 
> However, $v and $V (and seemingly $r and $R, the undocumented registers of
bug #61683) are exceptions to this: the macro package provides no way* to set
the line spacing other than by changing those registers directly.  Indeed,
e.tmac initializes $v and $V to default values but otherwise never sets them
(aside from the special case quoted in #61683 where $r or $R is set), meaning
it is up to the user to change them if she cares to.  So they violate the
manual's general edict concerning $-named registers.
> 
> It probably doesn't make much sense to rename them at this stage, so maybe
that sentence in the reference manual needs to carve out a $v/$V exception. 
Alternately (and more complicatedly), new registers in the correct namespace
could be defined for new -me documents, keeping $v and $V around only for back
compatibility.
> 
> * No sanctioned way, that is.  The user can call the low-level roff request
.vs, but this request is not on -me's "use with impunity" list" -- which makes
sense, because any line spacing the user set this way would get clobbered next
time -me set it from $v or $V.

Good point.

I think it would be straightforward to extend `sz` to accept an optional
second argument setting the vertical spacing.  The macro can check its own
context for whether it should set $v or $V.

[Later...]

In fact I went ahead and whipped this up.  Please try this patch.  It does not
appear to regress our in-tree me(7) documents.  (I merely eyeballed PostScript
output, checking for page breaks remaining in the same places.)

There are tabs in it, so I am attaching it as well.

One can observe that adding this functionality to `sz` simplifies logic in
several other parts of the package.

The two bits I'm unsure of are the argumentless call to `sz` in `@M`, which
might revert the type size back to something undesirable, and the XXX
comment.

What do you think?


diff --git a/tmac/e.tmac b/tmac/e.tmac
index a60b37cf7..9fd43d9bf 100644
--- a/tmac/e.tmac
+++ b/tmac/e.tmac
@@ -1087,10 +1087,10 @@
 .
 .de @M                 \" --- set modes for display
 .nr ?k 1
+.nr ?V 1
 .@C 1
 .@F \\n(df
-.if \\n($R .@V
-.vs \\n(.sp*\\n($Vu/100u
+.sz
 .nf
 .if "\\*(|p"F" \
 .      fi                      \" set fill mode if "F" parameter
@@ -1109,6 +1109,7 @@
 .br
 .if !"\\n(.z"|k" .do @err attempted close of never-opened keep
 .nr ?k 0
+.nr ?V 0
 .di
 .in 0
 .ce 0
@@ -1462,10 +1463,20 @@
 .\"            *** FONT AIDS ***
 .
 .
-.de sz                 \" *** set point size and vertical spacing      
+.de sz                 \" *** set type size and vertical spacing
 .ps \\$1
-.if \\n($r .@v
-.vs \\n(.sp*\\n($vu/100u       \" default vs at pointsize + 20%
+.if \\n(.$>1 \{\
+.      ie \\n(?V .nr $V \\$2
+.      el        .nr $v \\$2
+.\}
+.ie \\n(?V \{\
+.      if \\n($R .@V
+.      vs \\n(.sp*\\n($Vu/100u
+.\}
+.el \{\
+.      if \\n($r .@v
+.      vs \\n(.sp*\\n($vu/100u
+.\}
 ..
 .
 .de @v                 \" --- possibly set $v from $r
@@ -1575,7 +1586,6 @@
 .      xl \\n($lu-\\n(fuu
 .      @F \\n(ff
 .      sz \\n(fp
-.      vs \\n(.sp*\\n($Vu/100u
 .      if !\\n(?f \
 \{\
 .              nr _b +1v       \" allow space for $s
@@ -1594,7 +1604,6 @@
 .              xl \\n($lu-\\n(fuu
 .              @F \\n(ff
 .              sz \\n(fp
-.              vs \\n(.sp*\\n($Vu/100u
 .              if !\\n(?f \
 .                      $s
 .              br
@@ -1615,7 +1624,6 @@
 .      xl \\n($lu-\\n(fuu
 .      @F \\n(ff
 .      sz \\n(fp
-.      vs \\n(.sp*\\n($Vu/100u
 .      fi
 \!.(f \\$1
 \!.@N
@@ -1749,6 +1757,7 @@
 .br
 .@C 2
 .ls 1
+.\" XXX: Consider not altering the vertical spacing.
 .vs \\n(.sp*\\n($Vu/100u
 .fi
 .in +\\n(piu
@@ -2069,6 +2078,8 @@
 .@R fu\"               \" footnote undent
 .@R bt\"               \" block keep threshold
 .@R *\"                        \" has \** been referenced?
+.
+.\" internal Booleans
 .@R ?a\"               \" pending floating keep at page top?
 .@R ?b\"               \" pending floating keep at page bottom?
 .@R ?C\"               \" at chapter header?
@@ -2080,6 +2091,7 @@
 .@R ?R\"               \" renumbered chapter?
 .@R ?s\"               \" skip next page?
 .@R ?T\"               \" inside .TS H?
+.@R ?V\"               \" inside keep that uses $V for vert spacing?
 .@R ?W\"               \" wide floating keep at page bottom?
 .@R ?w\"               \" wide floating keep at page top?
 .


(file #52543)
    _______________________________________________________

Additional Item Attachment:

File name: me-sz.diff                     Size:2 KB
    <https://file.savannah.gnu.org/file/me-sz.diff?file_id=52543>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61710>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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