diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 2ac163d7a7e..6c406a8acd9 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -463,7 +463,8 @@ MODE is either `c' or `cpp'." ,@(when (eq mode 'cpp) '(((node-is "access_specifier") parent-bol 0) ;; Indent the body of namespace definitions. - ((parent-is "declaration_list") parent-bol c-ts-mode-indent-offset))) + ((parent-is "declaration_list") parent-bol c-ts-mode-indent-offset) + ((parent-is "template_declaration") parent-bol 0))) ;; int[5] a = { 0, 0, 0, 0 }; diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts index 24b244c1611..599173832b5 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts @@ -458,6 +458,34 @@ namespace test { } =-=-= +Name: Namespace and template (bug#72263) + +=-= +namespace A { + +T myfunction1(const char *fname) +{ +} + +template +T myfunction2(const char *fname) +{ +} +} +=-= +namespace A { + + T myfunction1(const char *fname) + { + } + + template + T myfunction2(const char *fname) + { + } +} +=-=-= + Code: (lambda () (c-ts-mode)