gbranden pushed a commit to branch master
in repository groff.

commit 8da97f653387012549d191dabcc10eaf3303c0a7
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Feb 18 19:42:45 2026 -0600

    [mm]: Refactor `ML` macro implementation.
    
    * contrib/mm/m.tmac (ML): Refactor to ease further bug fixing.  Call the
      `LB` macro that this macro wraps in one place, not three.  Introduce
      new temporary `li*pad-amount` register to manage the third argument we
      pass to `LB`, which varies depending on whether `ML` itself is given a
      (numeric expression as a) second argument or not.
---
 contrib/mm/ChangeLog |  9 +++++++++
 contrib/mm/m.tmac    | 13 ++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index 3f5a763cf..dc80f82a7 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,12 @@
+2026-02-18  G. Branden Robinson <[email protected]>
+
+       * m.tmac (ML): Refactor to ease further bug fixing.  Call the
+       `LB` macro that this macro wraps in one place, not three.
+       Introduce new temporary `li*pad-amount` register to manage the
+       third argument we pass to `LB`, which varies depending on
+       whether `ML` itself is given a (numeric expression as a) second
+       argument or not.
+
 2026-02-18  G. Branden Robinson <[email protected]>
 
        * m.tmac (LB): Fix spurious warnings.  Refactor to clarify
diff --git a/contrib/mm/m.tmac b/contrib/mm/m.tmac
index e332bfa22..676e2e52e 100644
--- a/contrib/mm/m.tmac
+++ b/contrib/mm/m.tmac
@@ -2789,18 +2789,21 @@ exceeds depth of nested lists (\\n[li*lvl])
 .if \\n[.$]>3 .@warning \\$0: ignoring excess arguments
 .if \\n[.$]<1 .@error \\$0: expected 1 to 3 arguments, got \\n[.$]
 .nr li*text-indent \w@\\$1@u+1n
-.ie \\n[.$]<2 .LB        \\n[li*text-indent]u 0 0 0 "\\$1"
-.el \{\
-.      if !\B'\\$2' \{\
+.nr li*pad-amount 0
+.if \\n[.$]>1 \{\
+.      ie !\B'\\$2' \{\
 .              ds li*msg \\$0: text-indent argument is not numeric:\"
 .              as li*msg " '\\$2'\"
 .              @error \\*[li*msg]
 .      \}
-.      ie \\n[.$]=2 .LB \\$2                 0 1 0 "\\$1"
-.      el           .LB \\n[li*text-indent]u 0 0 0 "\\$1"
+.      el \{\
+.              nr li*text-indent (n;\\$2)
+.              nr li*pad-amount 1
 .      \}
 .\}
+.LB \\n[li*text-indent]u 0 \\n[li*pad-amount] 0 "\\$1"
 .rr li*text-indent
+.rr li*pad-amount
 ..
 .\" ####### module tbl #######################################
 .\" This module is copied from groff_ms and modified for mm.

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to