1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-23 06:00:41 -08:00

Fix c++-ts-mode indentation for templace (bug#72263)

* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--indent-styles): Add rule for template.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: Add test.
This commit is contained in:
Yuan Fu 2024-07-31 23:45:26 -07:00
parent 1154d8aafe
commit cb421286d2
No known key found for this signature in database
GPG key ID: 56E19BC57664A442
2 changed files with 30 additions and 1 deletions

View file

@ -463,7 +463,8 @@ MODE is either `c' or `cpp'."
,@(when (eq mode 'cpp) ,@(when (eq mode 'cpp)
'(((node-is "access_specifier") parent-bol 0) '(((node-is "access_specifier") parent-bol 0)
;; Indent the body of namespace definitions. ;; 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 }; ;; int[5] a = { 0, 0, 0, 0 };

View file

@ -458,6 +458,34 @@ namespace test {
} }
=-=-= =-=-=
Name: Namespace and template (bug#72263)
=-=
namespace A {
T myfunction1(const char *fname)
{
}
template <class T>
T myfunction2(const char *fname)
{
}
}
=-=
namespace A {
T myfunction1(const char *fname)
{
}
template <class T>
T myfunction2(const char *fname)
{
}
}
=-=-=
Code: Code:
(lambda () (lambda ()
(c-ts-mode) (c-ts-mode)