groff-commit
[Top][All Lists]
Advanced

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

[groff] 02/02: [man]: Stop SY/YS from re-enabling hyphenation.


From: G. Branden Robinson
Subject: [groff] 02/02: [man]: Stop SY/YS from re-enabling hyphenation.
Date: Mon, 9 Jan 2023 15:43:52 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 82db4baa23d5f41671197ed75613609a0553d42b
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Jan 8 11:13:03 2023 -0600

    [man]: Stop SY/YS from re-enabling hyphenation.
    
    * tmac/an-ext.tmac: Move the saving of the hyphenation mode from the
      "top level" to...
      (mY): ...this new macro.
    
      (SY, mQ, MR): Call `mY` before disabling hyphenation.
    
    Problem introduced by me in commit 096c2f0567, 16 February.
    "an-ext.tmac" gets sourced by "an.tmac" before any command-line setting
    of the `HY` register is handled, so (for groff) the stored hyphenation
    mode was the default for the language, not reflecting user disablement.
    The synopsis macros, which do not have an alternate implementation in
    "an.tmac" for leverage of groff features, were causing hyphenation to be
    resurrected (after `YS`) even if the user had disabled it.  Saving the
    hyphenation mode anew upon entry to these macros is arguably
    inefficient, but it is more correct since a man page could conceivably
    manipulate the automatic hyphenation mode (even if that's not
    recommended outside of tbl(1) text blocks).
---
 ChangeLog        | 20 ++++++++++++++++++++
 tmac/an-ext.tmac | 17 ++++++++++++-----
 2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d388f4f1d..9f8643895 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2023-01-08  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * tmac/an-ext.tmac: Move the saving of the hyphenation mode from
+       the "top level" to...
+       (mY): ...this new macro.
+       (SY, mQ, MR): Call `mY` before disabling hyphenation.
+
+       Problem introduced by me in commit 096c2f0567, 16 February.
+       "an-ext.tmac" gets sourced by "an.tmac" before any
+       command-line setting of the `HY` register is handled, so (for
+       groff) the stored hyphenation mode was the default for the
+       language, not reflecting user disablement.  The synopsis macros,
+       which do not have an alternate implementation in "an.tmac" for
+       leverage of groff features, were causing hyphenation to be
+       resurrected (after `YS`) even if the user had disabled it.
+       Saving the hyphenation mode anew upon entry to these macros is
+       arguably inefficient, but it is more correct since a man page
+       could conceivably manipulate the automatic hyphenation mode
+       {even if that's not recommended outside of tbl(1) text blocks}.
+
 2023-01-08  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [man]: Add regression test for hyphenation getting wrongly
diff --git a/tmac/an-ext.tmac b/tmac/an-ext.tmac
index f9fe37306..5035bb292 100644
--- a/tmac/an-ext.tmac
+++ b/tmac/an-ext.tmac
@@ -37,13 +37,17 @@
 .ds mC CW
 .if n .ds mC R
 .
+.\" Save the automatic hyphenation mode.
+.\"
 .\" In AT&T troff, there was no register exposing the hyphenation mode,
-.\" and no way to save and restore it.  Set this to a reasonable value
+.\" and no way to save and restore it.  Set `mH` to a reasonable value
 .\" for your implementation and preference.
-.ie !\n(.g \
-.  nr mH 14
-.el \
-.  do nr mH \n[.hy]
+.de mY
+.  ie !\\n(.g \
+.    nr mH 14
+.  el \
+.    do nr mH \\n[.hy] \" groff extension register
+..
 .
 .nr mS 0 \" in a synopsis (SY/YS)?
 .nr mE 0 \" in an example (EX/EE)?
@@ -52,6 +56,7 @@
 .\" Declare start of command synopsis.  Sets up hanging indentation.
 .de SY
 .  ie !\\n(mS \{\
+.    mY
 .    nh
 .    nr mS 1
 .    nr mA \\n(.j
@@ -90,6 +95,7 @@
 .\" Emit hyperlink.  The optional argument supplies trailing punctuation
 .\" after link text.  `ME` and `UE` call this.
 .de mQ
+.  mY
 .  nh
 <\\*(m1>\\$1
 .  hy \\n(mH
@@ -132,6 +138,7 @@
 .\" .MR page-topic page-section [trailing-text]
 .if \n(.g-\n(mG \{\
 .de MR
+.  mY
 .  nh
 .  ie \\n(.$=1 \
 .    I \\$1



reply via email to

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