gbranden pushed a commit to branch master
in repository groff.
commit 798dbd6f1e4c695c93cfee79da5fcb9a1b4e485b
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Feb 18 14:34:31 2026 -0600
[mm]: Fix Savannah #68066.
* contrib/mm/m.tmac (LB): Fix spurious warnings. Refactor to clarify
logic, since I proved inadequate to the task of penetrating its
dialect before. Document expected range of fourth macro argument.
Assign register format to registers used as list item enumerators in
one place instead of three. Introduce new temporary register
`li*mf-is-mark` to elucidate the peculiar status of macro's fifth
argument as an untagged union type. (Why is it that _bad_ ideas are
adopted so much more aggressively than _good_ ones?) Rearrange logic
that parses this fifth argument (tracked as `li*mf`) for validity as a
register format. Replace highly specific check for `\&` as an
argument using GNU troff's "string comparison" extension with a simple
test for nonempty formatted output. It's more (traditionally)
idiomatic and captures any other synonymous ways that the fifth macro
argument might be "nothing". Assemble lengthy diagnostic message into
a temporary string, simplifying its emission.
Fixes <https://savannah.gnu.org/bugs/?68066>. Problem introduced by me
in commit ae66055171, 3 August 2025.
---
contrib/mm/ChangeLog | 23 +++++++++++++++++++++++
contrib/mm/m.tmac | 39 +++++++++++++++++++++------------------
2 files changed, 44 insertions(+), 18 deletions(-)
diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index 6ef5ca558..3f5a763cf 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,26 @@
+2026-02-18 G. Branden Robinson <[email protected]>
+
+ * m.tmac (LB): Fix spurious warnings. Refactor to clarify
+ logic, since I proved inadequate to the task of penetrating its
+ dialect before. Document expected range of fourth macro
+ argument. Assign register format to registers used as list item
+ enumerators in one place instead of three. Introduce new
+ temporary register `li*mf-is-mark` to elucidate the peculiar
+ status of macro's fifth argument as an untagged union type.
+ {Why is it that _bad_ ideas are adopted so much more
+ aggressively than _good_ ones?} Rearrange logic that parses
+ this fifth argument (tracked as `li*mf`) for validity as a
+ register format. Replace highly specific check for `\&` as an
+ argument using GNU troff's "string comparison" extension with a
+ simple test for nonempty formatted output. It's more
+ {traditionally} idiomatic and captures any other synonymous ways
+ that the fifth macro argument might be "nothing". Assemble
+ lengthy diagnostic message into a temporary string, simplifying
+ its emission.
+
+ Fixes <https://savannah.gnu.org/bugs/?68066>. Problem
+ introduced by me in commit ae66055171, 3 August 2025.
+
2026-02-18 G. Branden Robinson <[email protected]>
* tests/lists-indent-correctly.sh: Add test for quantity of
diff --git a/contrib/mm/m.tmac b/contrib/mm/m.tmac
index 840eb7bf3..e332bfa22 100644
--- a/contrib/mm/m.tmac
+++ b/contrib/mm/m.tmac
@@ -2554,7 +2554,7 @@ h=\\n[df*height!\\n[df*o-fnr]]
.nr li*tind (n;0\\$1)\" text-indent
.nr li*mind (n;0\\$2)\" mark-indent
.nr li*pad (n;0\\$3)\" pad
-.nr li*type 0\\$4\" type
+.nr li*type 0\\$4\" type (in range -1..6)
.ds li*mf \\$5\" mark-or-format
.ie !'\\$6'' .nr li*li-spc \\$6\" LI-space
.el .nr li*li-spc 1
@@ -2562,27 +2562,30 @@ h=\\n[df*height!\\n[df*o-fnr]]
.el .nr li*lb-spc 0
.\" init listcounter
.nr li*cnt!\\n[li*lvl] 0 1
-.\" assign format
-.af li*cnt!\\n[li*lvl] 1
+.nr li*mf-is-mark 1
.if \\n[li*type] \{\
-. ie '\?\\*[li*mf]\?'\?\&\?' .af li*cnt!\\n[li*lvl] 0
-. el \{\
-. nr li*is-format-valid 0
-. if '\?\\*[li*mf]\?'\?a\?' .nr li*is-format-valid 1
-. if '\?\\*[li*mf]\?'\?A\?' .nr li*is-format-valid 1
-. if '\?\\*[li*mf]\?'\?i\?' .nr li*is-format-valid 1
-. if '\?\\*[li*mf]\?'\?I\?' .nr li*is-format-valid 1
-. if \B'\\*[li*mf]' \
-. if \\*[li*mf]>-1 .nr li*is-format-valid 1
-. if !\\n[li*is-format-valid] \{\
-. @warning \\$0: type argument is \\n[li*type] \
-but mark argument '\\*[li*mf]' is not a valid register format; \
-assuming '0'
-. ds li*mf 0\"
+. nr li*mf-is-mark 0
+. if '\\*[li*mf]'' .ds li*mf 0\"
+. nr li*is-format-valid 0
+. if '\?\\*[li*mf]\?'\?a\?' .nr li*is-format-valid 1
+. if '\?\\*[li*mf]\?'\?A\?' .nr li*is-format-valid 1
+. if '\?\\*[li*mf]\?'\?i\?' .nr li*is-format-valid 1
+. if '\?\\*[li*mf]\?'\?I\?' .nr li*is-format-valid 1
+. if \B'\\*[li*mf]' .if \\*[li*mf]>-1 .nr li*is-format-valid 1
+. if !\\n[li*is-format-valid] \{\
+. ds li*msg \\$0: type argument is \\n[li*type]\"
+. as li*msg " but mark argument '\\*[li*mf]'\"
+. as li*msg " is not a valid register format;\"
+. as li*msg " assuming '0'\"
+. @warning \\*[li*msg]
+. rm li*msg
+. ds li*mf 0\"
. \}
-. af li*cnt!\\n[li*lvl] \\*[li*mf]
. \}
.\}
+.ie \\n[li*mf-is-mark] .af li*cnt!\\n[li*lvl] 0
+.el .af li*cnt!\\n[li*lvl] \\*[li*mf]
+.rr li*mf-is-mark
.\"
.if \\n[li*lb-spc] .SP (u;\\n[li*lb-spc]*\\n[Lsp])
.in +\\n[li*tind]u
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit