emacs-31 c0a33a474d3: Fix c-ts-mode bsd-style indentation of union bodies (bug#81255)

Yuan Fu <[email protected]>
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: emacs-31
commit c0a33a474d3f536357b125996b16a9ace484199d
Author: समीर सिंह Sameer Singh <[email protected]>
Commit: Yuan Fu <[email protected]>

    Fix c-ts-mode bsd-style indentation of union bodies (bug#81255)
    
    * lisp/progmodes/c-ts-mode.el (c-ts-mode--simple-indent-rules): Add
    "union_specifier" to the parent-is regexp.
    
    * test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts: New test.
---
 lisp/progmodes/c-ts-mode.el                             | 1 +
 test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index d08615446a1..5f064716a89 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -501,6 +501,7 @@ MODE can be `c' or `cpp'.  STYLE can be `gnu', `k&r', `linux', `bsd'."
            ((parent-is ,(rx (or "function_definition"
                                 "struct_specifier"
                                 "enum_specifier"
+                                "union_specifier"
                                 "function_declarator"
                                 "template_declaration")))
             standalone-parent 0)
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts b/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts
index 2325b3b008d..66a8153c63f 100644
--- a/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts
+++ b/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts
@@ -125,3 +125,12 @@ if (true)
 else
         break;
 =-=-=
+
+Name: Union (bug#81255)
+
+=-=
+union u
+{
+        int i;
+};
+=-=-=
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.