gbranden pushed a commit to branch master
in repository groff.

commit 88972567605e7d4e89fc4c7fc6816f7174cd40fe
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Nov 16 18:28:22 2025 -0600

    [troff]: Improve `\O` escape sequence diagnostics.
    
    * src/roff/troff/input.cpp (do_suppress): Improve diagnostic message
      when input malformatted; the one we had wasn't clear in the easily
      anticipated scenario where the user assumes that `\O` is a delimited
      escape sequence (it isn't) and selects "'" as the "delimiter".
---
 ChangeLog                | 8 ++++++++
 src/roff/troff/input.cpp | 7 +++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9957a0b49..8605d24d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-11-16  G. Branden Robinson <[email protected]>
+
+       * src/roff/troff/input.cpp (do_suppress): Improve diagnostic
+       message when input malformatted; the one we had wasn't clear in
+       the easily anticipated scenario where the user assumes that `\O`
+       is a delimited escape sequence (it isn't) and selects "'" as
+       the "delimiter".
+
 2025-11-16  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/env.cpp (add_hyphenation_exceptions):
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 759427e9c..06d9d3dde 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -6753,8 +6753,11 @@ static node *do_suppress(symbol nm) // \O
     }
     break;
   default:
-    error("invalid argument '%1' to output suppression escape sequence",
-         *s);
+    char qc = '\'';
+    if (strchr(s, '\'') != 0 /* nullptr */)
+      qc = '"';
+    error("invalid argument %1%2%3 to output suppression escape"
+         " sequence", qc, *s, qc);
   }
   return 0 /* nullptr */;
 }

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

Reply via email to