From: Daniel Martín Date: Sun, 19 Feb 2023 21:57:54 +0000 (+0100) Subject: Add declaration_list to c-ts-common-indent-type-regexp-alist X-Git-Tag: emacs-29.0.90~372 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d7010d64b216b3adf7dd5adcc9bb62c7208b8d43;p=emacs.git 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. --- diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 76c80d9a068..6d70dc3198e 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -814,7 +814,8 @@ the semicolon. This function skips the semicolon." `((block . ,(rx (or "compound_statement" "field_declaration_list" "enumerator_list" - "initializer_list"))) + "initializer_list" + "declaration_list"))) (if . "if_statement") (else . ("if_statement" . "alternative")) (do . "do_statement") diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts index 09c8ebcec44..36d7af4faf1 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts @@ -369,3 +369,19 @@ int main() }; } =-=-= + +Code: + (lambda () + (c++-ts-mode) + (setq-local indent-tabs-mode nil) + (setq-local c-ts-mode-indent-offset 2) + (indent-region (point-min) (point-max))) + +Name: Declaration List (Namespace) (Bug#61635) + +=-= +namespace test { + class Name { + }; +} +=-=-=