gbranden pushed a commit to branch master
in repository groff.
commit ca100e202dc0841e95d80a3e7d86412195d57854
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Jul 20 14:34:24 2025 -0500
[man]: Paragraphing macros reset hyphenation mode.
* tmac/an.tmac (an*reset-paragraph-parameters): Call
`an*reset-hyphenation-mode`.
(TH): Stop calling `an*reset-hyphenation-mode`.
* tmac/groff_man.7.man.in (Paragraphing macros): Document paragraphing
macros' restoration of configured hyphenation mode.
---
ChangeLog | 8 ++++++++
tmac/an.tmac | 24 ++++++++++++++++++++----
tmac/groff_man.7.man.in | 3 ++-
3 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8214a1cf2..27acfa0f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-07-20 G. Branden Robinson <[email protected]>
+
+ * tmac/an.tmac (an*reset-paragraph-parameters): Call
+ `an*reset-hyphenation-mode`.
+ (TH): Stop calling `an*reset-hyphenation-mode`.
+ * tmac/groff_man.7.man.in (Paragraphing macros): Document
+ paragraphing macros' restoration of configured hyphenation mode.
+
2025-07-20 G. Branden Robinson <[email protected]>
[man]: Add `mN` register to track whether we're setting a
diff --git a/tmac/an.tmac b/tmac/an.tmac
index 4a05de6cc..d94af8f76 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -122,7 +122,24 @@
. el .an*break-page-with-new-number
..
.
-.\" `TH` and localization macro files call this.
+.\" Resetting the hyphenation mode is a complicated dance because:
+.\" 1. Man pages sometimes disable automatic hyphenation--when they
+.\" do, they nearly always forget to put it back the way it was;
+.\" 2. in AT&T troff there was no register exposing the hyphenation
+.\" mode (nor the enablement status of automatic hyphenation), so
+.\" no idioms for performing such restoration have arisen;
+.\" 3. groff man(7)'s `HY` register isn't supported everywhere;
+.\" 4. we want user preferences, if expressed, to override the page
+.\" author's; and
+.\" 5. even if we didn't want (4), one page author's can override
+.\" another's when formatting multiple man(7) documents in
+.\" sequence--we thus keep track of the initial hyphenation mode.
+.\"
+.\" So we recover the "page's" preferred hyphenation mode, if expressed
+.\" via `HY`, at every paragraph (and (sub)sectioning macro call; and
+.\" recover the user's preferred hyphenation mode at each new document.
+.\"
+.\" Also see the initialization logic below.
.de an*reset-hyphenation-mode
. nr an*want-hyphenation 1
. if r HY .if !\\n[HY] .nr an*want-hyphenation 0
@@ -155,7 +172,7 @@
. ps \\n[PS]u
. vs \\n[VS]u
. \" TODO: ad \\*[AD]
-. \" TODO: hy \\n[HY]
+. an*reset-hyphenation-mode
..
.
.\" This logic would be part of `an*reset-paragraph-parameters`, but
@@ -294,7 +311,6 @@
. an*reset-paragraph-parameters
. ll \\n[LL]u
. in 0 \" Well-formed documents call `SH` after `TH`.
-. an*reset-hyphenation-mode
. an*reset-tab-stops
. an*reset-paragraph-spacing
.
@@ -1548,7 +1564,7 @@ contains unsupported escape sequence
. \}
.\}
.
-.\" We handle `HY` in the `TH` macro definition, not here.
+.\" We handle `HY` in `an*reset-hyphenation-mode`, not here.
.
.\" standard indentation
.if !r IN \{\
diff --git a/tmac/groff_man.7.man.in b/tmac/groff_man.7.man.in
index a57d65eee..8a2ce3c96 100644
--- a/tmac/groff_man.7.man.in
+++ b/tmac/groff_man.7.man.in
@@ -840,7 +840,8 @@ see subsection \[lq]Horizontal and vertical spacing\[rq]
below.
Except for
.BR TQ ,
these macros
-reset the type size and font style to defaults.
+reset the type size and font style to defaults,
+and restore the configured hyphenation mode.
.\" slack wording for managing stranded lines in PS/PDF output
.\" [end previous text line with semicolon, not period]
.\"see subsections \[lq]Font style macros\[rq] and \[lq]Options\[rq]
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit