bug-groff
[Top][All Lists]
Advanced

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

[bug #61428] [me] new page-length restriction too restrictive


From: G. Branden Robinson
Subject: [bug #61428] [me] new page-length restriction too restrictive
Date: Thu, 3 Feb 2022 15:34:46 -0500 (EST)

Update of bug #61428 (project groff):

                  Status:               Need Info => In Progress            

    _______________________________________________________

Follow-up Comment #11:

[comment #8 comment #8:]
> [comment #6 comment #6:]
> > I'm all for minimal reproducing cases, but that one might be
> > _too_ minimal...!  It doesn't really exercise any me(7)
> > features.  The package gets initialized, sure...
> 
> That was sort of its point: even without using anything me-ey, the very
presence of the -me package rejected (what might, arguably, be) valid input.

Upon further reflection, I would argue _against_ that position.

_me_(7) _unconditionally_ sets up header and footer traps.  Even the `hx`
macro doesn't unset them; it simply causes the titles to not be emitted when
they are encountered.  See registers `?H`, `?h`, and the macro `@t`.
 
> Still, it's easy to stick in a -me paragraphing macro before the Hello and
get the same results.

> printf '.pl 10v\n.pp\nHello.\n' | groff -me -Tascii

Yes.

> But a reasonable counterargument is that it _should_ stop working unless I
also told -me to use no bottom margins; otherwise, I've made my terminal
"page" too short to handle all the requested output.

Yes, I think that is the argument that _me_(7) itself would adopt if it could
speak, just going by the way it is written.

It's the top margin, too.  But with modifications to zero out _all_ of the
vertical margins, including `hm` and `fm` as well, I can get you down to two
lines.


$ printf '.pl 2v\n.nr fm 0\n.nr hm 0\n.nr tm 0\n.nr bm (-0)\nHello.\n' | tg
-me -Tascii

Hello.


If you want _me_(7) to do single-line document formatting, please file that as
a separate ticket.  :P

Here's the patch.


diff --git a/tmac/e.tmac b/tmac/e.tmac
index 91dc19830..2c2678817 100644
--- a/tmac/e.tmac
+++ b/tmac/e.tmac
@@ -81,11 +81,6 @@
 .rm @line
 ..
 .
-.\" --- sanity check the page dimensions
-.do de check_page_length
-.if (\\n(.pu<14v) .ab \\*(_e: cannot format short page length \\n(.pu
-..
-.
 .\" --- check whether grohtml needs end of title/heading
 .do de1 @html_check_need_title
 .if \\n[devtag-needs-end-of-title] \
@@ -279,8 +274,13 @@
 .
 .de @h                 \" --- header
 .if \n@>1 .tm >> @h %=\\n% ?a=\\n(?a ?b=\\n(?b ?w=\\n(?w
-.if (\\n(.i+\\n(.o)>=\\n(.l \
-.      @err page offset plus indentation exceeds line length
+.do if (u;\\n(tm+\\n(bm+\\n(.V>\\n(.p) \{\
+.      do @err insufficient page length; aborting
+.      pl \\n(nlu
+.      ab
+.\}
+.do if (u;\\n(.i+\\n(.o>=\\n(.l) \
+.      do @err page offset plus indentation exceeds line length
 .\" initialize a pile of junk
 .nr ?h \\n(?H                  \" transfer "next page" to "this page"
 .nr ?H 0
@@ -511,7 +511,6 @@
 .if !'\*(.T'html' .rn bp @b    \" --- begin page
 .
 .de bp                 \" *** begin new page (overrides columns)
-.do check_page_length
 .nr $c \\n($m                  \" force new page, not new column
 .ie \\n(nl>0 \
 .      @b \\$1
@@ -535,13 +534,6 @@
 .      nr _L \\n(.l
 ..
 .
-.rn pl xP              \" --- save troff page length request
-.
-.de pl                 \" *** set page length
-.xP \\$1
-.do check_page_length
-..
-.
 .rn po @O              \" --- local page offset
 .
 .de po                 \" *** page offset
@@ -813,7 +805,6 @@
 ..
 .
 .de @p                 \" --- initialize for paragraph
-.do check_page_length
 .do check_need_title
 .if "\\n(.z"|e" .do @err eqn equation continuation unfulfilled
 .in \\n($iu+\\n(pou
@@ -834,7 +825,6 @@
 .
 .
 .de sh                 \" *** section heading
-.do check_page_length
 .fi
 .do check_need_title
 .if (\\n(si>0)&(\\n(si<1n) \
@@ -973,7 +963,6 @@
 .
 .
 .de 2c                 \" *** double columned output
-.do check_page_length
 .br
 .if \\n($m>1 \
 .      1c\"                            \" revert to 1c if already 2c
@@ -991,7 +980,6 @@
 ..
 .
 .de 1c                 \" *** single columned output
-.do check_page_length
 .br
 .nr $c 1
 .nr $m 1


Keith's method (which he illustrated in ms(7)) of putting the page length
check in the page trap is much cleaner than what I was doing.  Apart from
being less intrusive, it seems to respect an element of *roff philosophy
better--you can break something into a thousand pieces if you want, as long as
you put it back together before the formatter needs it.





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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