* lisp/progmodes/c-ts-mode.el (c-ts-mode--simple-indent-rules): Add "union_specifier" to the parent-is regexp. * test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts: New test.
137 lines
1.4 KiB
Plaintext
137 lines
1.4 KiB
Plaintext
Code:
|
|
(lambda ()
|
|
(c-ts-mode)
|
|
(setq-local indent-tabs-mode nil)
|
|
(setq-local c-ts-mode-indent-offset 8)
|
|
(c-ts-mode-set-style 'bsd)
|
|
(indent-region (point-min) (point-max)))
|
|
|
|
Point-Char: |
|
|
|
|
Name: Basic
|
|
|
|
=-=
|
|
int
|
|
main (void)
|
|
{
|
|
return 0;
|
|
}
|
|
=-=-=
|
|
|
|
Name: Hanging Braces
|
|
|
|
=-=
|
|
int
|
|
main (void)
|
|
{
|
|
if (true)
|
|
{
|
|
|
|
|
}
|
|
}
|
|
=-=-=
|
|
|
|
Name: Labels
|
|
|
|
=-=
|
|
int
|
|
main (void)
|
|
{
|
|
label:
|
|
return 0;
|
|
if (true)
|
|
{
|
|
label:
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
if (true)
|
|
{
|
|
label:
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
=-=-=
|
|
|
|
Name: If-Else
|
|
|
|
=-=
|
|
int main()
|
|
{
|
|
if (true)
|
|
{
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
=-=-=
|
|
|
|
Name: Empty Line
|
|
=-=
|
|
int main()
|
|
{
|
|
|
|
|
}
|
|
=-=-=
|
|
|
|
Name: Consecutive blocks (bug#60873)
|
|
|
|
=-=
|
|
int
|
|
main (int argc,
|
|
char *argv[])
|
|
{
|
|
{
|
|
int i = 0;
|
|
}
|
|
}
|
|
=-=-=
|
|
|
|
Name: Bracketless Simple Statement (bug#66152)
|
|
|
|
=-=
|
|
for (int i = 0; i < 5; i++)
|
|
continue;
|
|
|
|
while (true)
|
|
return 1;
|
|
|
|
do
|
|
i++;
|
|
while (true)
|
|
|
|
if (true)
|
|
break;
|
|
else
|
|
break;
|
|
=-=
|
|
for (int i = 0; i < 5; i++)
|
|
continue;
|
|
|
|
while (true)
|
|
return 1;
|
|
|
|
do
|
|
i++;
|
|
while (true)
|
|
|
|
if (true)
|
|
break;
|
|
else
|
|
break;
|
|
=-=-=
|
|
|
|
Name: Union (bug#81255)
|
|
|
|
=-=
|
|
union u
|
|
{
|
|
int i;
|
|
};
|
|
=-=-=
|