diff options
author | Yuan Fu <casouri@gmail.com> | 2023-01-25 23:47:27 -0800 |
---|---|---|
committer | Yuan Fu <casouri@gmail.com> | 2023-01-25 23:47:27 -0800 |
commit | cdf74254ffa2c53612f6d985e3774b51233fbd49 (patch) | |
tree | d1bc32bc8f622bce15efa9335187b10411d4cfed /test/lisp/progmodes | |
parent | 4bd06ce2a9fa1601aff5a5fcab7411e5fce20d28 (diff) | |
download | emacs-cdf74254ffa2c53612f6d985e3774b51233fbd49.tar.gz emacs-cdf74254ffa2c53612f6d985e3774b51233fbd49.tar.bz2 emacs-cdf74254ffa2c53612f6d985e3774b51233fbd49.zip |
Fix indentation for c-ts-mode (bug#61026)
Fix indentation for things like
while (true)
if (true)
{
puts ("Hello");
}
Note that the outer while loop omits brackets.
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--statement-offset-post-processr): New variable.
(c-ts-mode--statement-offset): Use the new function.
(c-ts-mode--fix-bracketless-indent): New function.
(c-ts-base-mode): Use the new function.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New tests.
Diffstat (limited to 'test/lisp/progmodes')
-rw-r--r-- | test/lisp/progmodes/c-ts-mode-resources/indent.erts | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts index b8524432d02..67654404a77 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts @@ -105,6 +105,58 @@ main (int argc, } =-=-= +Name: Bracket-less Block-Statement (GNU Style) (bug#61026) + +=-= +int main() { + while (true) + if (true) + { + puts ("Hello"); + } + for (int i=0; i<5; i++) + if (true) + { + puts ("Hello"); + } + do + if (true) + { + puts ("Hello"); + } + while (true); + if (true) + if (true) + { + puts ("Hello"); + } +} +=-=-= + +Name: Bracket-less Block-Statement (Linux Style) (bug#61026) + +=-=-= +int main() { + while (true) + if (true) { + puts ("Hello"); + } + for (int i=0; i<5; i++) + if (true) { + puts ("Hello"); + } + do + if (true) { + puts ("Hello"); + } + while (true); + if (true) + if (true) { + puts ("Hello"); + } +} +=-=-= + Name: Multiline Parameter List (bug#60398) =-= |