]> git.eshelyaron.com Git - emacs.git/commitdiff
Add declaration_list to c-ts-common-indent-type-regexp-alist
authorDaniel Martín <mardani29@yahoo.es>
Sun, 19 Feb 2023 21:57:54 +0000 (22:57 +0100)
committerTheodor Thornhill <theo@thornhill.no>
Mon, 20 Feb 2023 14:07:56 +0000 (15:07 +0100)
* 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.

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

index 76c80d9a06819f3383cd9d49dae054a59e193559..6d70dc3198e35af63e3c8aa83de4f3d86fb6aea0 100644 (file)
@@ -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")
index 09c8ebcec4456da64683924cf0d2a76fcf6495d3..36d7af4faf15106bf814db0fa2a58072e2372f4d 100644 (file)
@@ -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 {
+  };
+}
+=-=-=