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:
parent
1154d8aafe
commit
cb421286d2
2 changed files with 30 additions and 1 deletions
|
@ -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 };
|
||||
|
|
|
@ -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:
|
||||
(lambda ()
|
||||
(c-ts-mode)
|
||||
|
|
Loading…
Add table
Reference in a new issue