Skip to content

Commit d7010d6

Browse files
danielmartintheothornhill
authored andcommitted
Add declaration_list to c-ts-common-indent-type-regexp-alist
* lisp/progmodes/c-ts-mode.el (c-ts-base-mode): Consider a "declaration_list" a block. (Bug#61635) * test/lisp/progmodes/c-ts-mode-resources/indent.erts (Code): Add a test case.
1 parent 19480aa commit d7010d6

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lisp/progmodes/c-ts-mode.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,8 @@ the semicolon. This function skips the semicolon."
814814
`((block . ,(rx (or "compound_statement"
815815
"field_declaration_list"
816816
"enumerator_list"
817-
"initializer_list")))
817+
"initializer_list"
818+
"declaration_list")))
818819
(if . "if_statement")
819820
(else . ("if_statement" . "alternative"))
820821
(do . "do_statement")

test/lisp/progmodes/c-ts-mode-resources/indent.erts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,3 +369,19 @@ int main()
369369
};
370370
}
371371
=-=-=
372+
373+
Code:
374+
(lambda ()
375+
(c++-ts-mode)
376+
(setq-local indent-tabs-mode nil)
377+
(setq-local c-ts-mode-indent-offset 2)
378+
(indent-region (point-min) (point-max)))
379+
380+
Name: Declaration List (Namespace) (Bug#61635)
381+
382+
=-=
383+
namespace test {
384+
class Name {
385+
};
386+
}
387+
=-=-=

0 commit comments

Comments
 (0)