1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-17 03:10:58 -08:00
emacs/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts
Yuan Fu 7f1bd69cd1
Fix c-ts-mode bracketless indentation for BSD style (bug#66152)
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--indent-styles): Make sure the BSD rules only apply to
opening bracket (compound_statement), then bracketless statements will
fallback to common rules.
* test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts: Copy the
bracketless test from indent.erts to here.
2023-12-10 18:24:27 -08:00

127 lines
1.1 KiB
Text

Code:
(lambda ()
(c-ts-mode)
(setq-local indent-tabs-mode nil)
(setq-local c-ts-mode-indent-offset 2)
(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;
=-=-=