diff options
| author | Jørgen Kvalsvik | 2024-11-19 08:01:01 +0100 |
|---|---|---|
| committer | Yuan Fu | 2024-12-01 17:53:21 -0800 |
| commit | c65c5d02224335562be7e04dd1bf185dfca3dbf1 (patch) | |
| tree | 83c7fe53580c6db7a7b26ba9bcffd9a94d6fdae0 /java | |
| parent | 4afd1eca3662eda052d0017f83b4baa1f6131e8b (diff) | |
| download | emacs-c65c5d02224335562be7e04dd1bf185dfca3dbf1.tar.gz emacs-c65c5d02224335562be7e04dd1bf185dfca3dbf1.zip | |
Improve c-ts-mode compound indents (bug#74507)
Properly indent the body of compound expressions, even when then
compound expression is not at the beginning of line and the
parent is not an if/for/while/etc., and matches the behavior of
c-mode.
This fixes a problem that is common with macros and in testing
frameworks. For example, you expect this to indent:
TEST_CASE(1) {
assert (...);
}
If the compound statement is the function body itself, don't
apply this new rule and instead guide by the parent and first
sibling.
I'm sure there are subtle interactions that aren't handled
properly by checking for "function_definition" rather than
something more general, but it does fix the test case and the
check can be improved as more cases are found.
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--parent-is-not-top-compound): New function.
(c-ts-mode--indent-styles): Use it.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New
compound statement test.
Diffstat (limited to 'java')
0 files changed, 0 insertions, 0 deletions