gbranden pushed a commit to branch master
in repository groff.

commit 9e60503c01f0f06632eb4c0b991da9d537ba7832
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed May 6 09:09:10 2026 -0500

    [grn]: Rename `-M` option to `-I`.
    
    ...better paralleling troff(1).  Inclusions are not the same things as
    macro file resources.
    
    * src/preproc/grn/main.cpp (main): Accept `-I`, `-L` (the original
      Berkeley name for this option), and `-M` (groff grn prior to this
      point) synonymously.
    
    * src/roff/groff/groff.cpp (main): Pass `-I` options as-is to grn.  Stop
      doing so for `-M` arguments.
    
    * doc/doc.am (doc/grnexmpl.ps): Pass groff option `-I` instead of `-M`.
    
    * src/preproc/grn/grn.1.man (Synopsis, Options):
    * NEWS: Document it.
    
    Fixes <https://savannah.gnu.org/bugs/?68276>.
---
 ChangeLog                 | 18 ++++++++++++++++++
 NEWS                      | 15 +++++++++++++++
 doc/doc.am                |  4 ++--
 src/preproc/grn/grn.1.man | 19 +++++++++++++++++--
 src/preproc/grn/main.cpp  |  4 +++-
 src/roff/groff/groff.cpp  |  3 +--
 6 files changed, 56 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 91b05f0f0..e9ed97d03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2026-05-06  G. Branden Robinson <[email protected]>
+
+       [grn]: Rename `-M` option to `-I`, better paralleling troff(1).
+       Inclusions are not the same things as macro file resources.
+
+       * src/preproc/grn/main.cpp (main): Accept `-I`, `-L` (the
+       original Berkeley name for this option), and `-M` (groff grn
+       prior to this point) synonymously.
+       * src/roff/groff/groff.cpp (main): Pass `-I` options as-is to
+       grn.  Stop doing so for `-M` arguments.
+       * doc/doc.am (doc/grnexmpl.ps): Pass groff option `-I` instead
+       of `-M`.
+
+       * src/preproc/grn/grn.1.man (Synopsis, Options):
+       * NEWS: Document it.
+
+       Fixes <https://savannah.gnu.org/bugs/?68276>.
+
 2026-05-06  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/env.cpp (temporary_indent_request): If given no
diff --git a/NEWS b/NEWS
index 20df87a02..e6d977529 100644
--- a/NEWS
+++ b/NEWS
@@ -66,6 +66,21 @@ troff
    old name remains as an alias configured by the default "troffrc"
    file.
 
+grn
+---
+
+*  The `-M` command-line option is renamed to to `-I`, better
+   paralleling troff(1).  Inclusions are not the same things as macro
+   file resources.  The program accepts `-L` (the original Berkeley name
+   for this option), and `-M` (groff grn prior to this point)
+   synonymously.
+
+groff
+-----
+
+*  groff now passes `-I` options as-is to grn(1), instead of translating
+   the option name to `-M`.
+
 Macro packages
 --------------
 
diff --git a/doc/doc.am b/doc/doc.am
index 631109f1e..ad3b55ddd 100644
--- a/doc/doc.am
+++ b/doc/doc.am
@@ -300,11 +300,11 @@ doc/groff-man-pages.utf8.txt: $(GROFF_MAN_PAGES_ALL) eqn 
pic tbl \
          $(tmac_srcdir)/sv.tmac $(GROFF_MAN_PAGES2) \
          $(tmac_srcdir)/en.tmac $(GROFF_MAN_PAGES3) > $@
 
-# `-M $(doc_srcdir)` is so that grn can find "grnexampl.g".
+# `-I $(doc_srcdir)` is so that grn can find "grnexampl.g".
 doc/grnexmpl.ps: $(doc_srcdir)/grnexmpl.me $(doc_srcdir)/grnexmpl.g \
   $(TMAC_PACKAGE_ME) grn eqn
        $(GROFF_V)$(MKDIR_P) `dirname $@` \
-       && $(DOC_GROFF) -Tps -ge -M $(doc_srcdir) -me \
+       && $(DOC_GROFF) -Tps -ge -I $(doc_srcdir) -me \
             $(doc_srcdir)/grnexmpl.me >$@
 
 # Generating *.me from *.me.in is, surprisingly, a challenge.
diff --git a/src/preproc/grn/grn.1.man b/src/preproc/grn/grn.1.man
index bdc6912cb..d8bfdbb97 100644
--- a/src/preproc/grn/grn.1.man
+++ b/src/preproc/grn/grn.1.man
@@ -58,7 +58,7 @@ documents
 .RB [ \-C ]
 .RB [ \-F\~\c
 .IR dir ]
-.RB [ \-M\~\c
+.RB [ \-I\~\c
 .IR dir ]
 .RB [ \-T\~\c
 .IR dev ]
@@ -903,7 +903,7 @@ and
 .
 .
 .TP
-.BI \-M\~ dir
+.BI \-I\~ dir
 Prepend
 .I dir
 to the search path for
@@ -917,6 +917,21 @@ the home directory,
 and
 .IR @MACRODIR@ ,
 in that order.
+.
+GNU
+.I grn \" GNU
+accepts
+.B \-L
+and
+.B \-M
+as synonyms of
+.B \-I
+for compatibility with Berkeley
+.I grn \" Berkeley
+and
+older versions of
+.IR groff ,
+respectively.
 .\".
 .\".
 .\".TP
diff --git a/src/preproc/grn/main.cpp b/src/preproc/grn/main.cpp
index 18c0cc0bd..c4143f9a1 100644
--- a/src/preproc/grn/main.cpp
+++ b/src/preproc/grn/main.cpp
@@ -349,7 +349,9 @@ main(int argc,
        device = operand(&argc, &argv);
        break;
 
-      case 'M':                /* set library directory */
+      case 'I':                /* set library directory */
+      case 'L':                /* original Berkeley synonym */
+      case 'M':                /* groff < 1.25 synonym */
        macro_path.command_line_dir(operand(&argc, &argv));
        break;
 
diff --git a/src/roff/groff/groff.cpp b/src/roff/groff/groff.cpp
index 93b88fcce..45853eb3c 100644
--- a/src/roff/groff/groff.cpp
+++ b/src/roff/groff/groff.cpp
@@ -189,7 +189,7 @@ int main(int argc, char **argv)
       break;
     case 'I':
       commands[GRN_INDEX].set_name(command_prefix, "grn");
-      commands[GRN_INDEX].append_arg("-M", optarg);
+      commands[GRN_INDEX].append_arg(buf, optarg);
       commands[SOELIM_INDEX].set_name(command_prefix, "soelim");
       commands[SOELIM_INDEX].append_arg(buf, optarg);
       // .psbb may need to search for files
@@ -360,7 +360,6 @@ int main(int argc, char **argv)
     case 'M':
       commands[EQN_INDEX].append_arg(buf, optarg);
       commands[GRAP_INDEX].append_arg(buf, optarg);
-      commands[GRN_INDEX].append_arg(buf, optarg);
       commands[TROFF_INDEX].append_arg(buf, optarg);
       break;
     case 'P':

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

Reply via email to