Code: (lambda () (c-ts-mode) (setq-local indent-tabs-mode nil) (setq-local c-ts-mode-indent-offset 2) (c-ts-mode-set-style 'gnu) (indent-region (point-min) (point-max))) Point-Char: | Name: Basic =-= int main (void) { return 0; } =-=-= Name: Hanging Braces (GNU Style) =-= int main (void) { if (true) { } } =-=-= Name: Labels (GNU Style) =-= int main (void) { label: return 0; if (true) { label: return 0; } else { if (true) { label: return 0; } } } =-=-= Name: For Loop with Multi-line Condition (GNU Style) =-= int main() { for (int i = 0; i < b; i++) { return 0; } } =-=-= Name: If-Else (GNU Style) =-= int main() { if (true) { return 0; } else { return 1; } } =-=-= Name: Consecutive blocks (GNU Style) (bug#60873) =-= int main (int argc, char *argv[]) { { int i = 0; } } =-=-= 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: Multiline Parameter List (bug#60398) =-= int f2(int x, int y) { return x + y; }; =-=-= Name: Semi-colon in While Loop (bug#61291) =-= while (true) ; for (int i = 0; i < 5; i++) ; =-=-= Name: Bracketless Simple Statement =-= 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: Nested If-Else =-= if (true) return 0; else if (false) return 1; else if (true) return 2; else if (false) return 3; =-=-= Name: Initializer List (Bug#61398) =-= int main() { const char *emoticons[][2] = { {":-)", "SLIGHTLY SMILING FACE"}, {";-)", "WINKING FACE"}, {":-(", "SLIGHTLY FROWNING FACE"}, }; } =-=-= Name: Return Compound Literal =-= struct pair { int fst, snd; }; struct pair make_pair(int long_identifier_a[], int long_identifier_b[], int offset_a, int offset_b) { int base_offset = 10; return (struct pair) { long_identifier_a[base_offset + offset_b], long_identifier_b[base_offset + offset_b] }; } =-=-= Name: Switch-Case statement =-= int main() { switch (a) { case 1: b = c; return 10; case 2: { a = b; return 12 } } } =-= int main() { switch (a) { case 1: b = c; return 10; case 2: { a = b; return 12 } } } =-=-= Name: Multiline Block Comments 1 (bug#60270) =-= /** * @some_func: * @arg1: */ =-=-= Name: Multiline Block Comments 2 (bug#60270) =-= /* some comment */ =-=-= Name: Multiline Block Comments 3 (bug#60270) =-= /* some comment */ =-=-= Name: Multiline Block Comments 4 (bug#60270) =-= /* * Some comment */ =-=-= Name: Multiline Block Comments 5 (bug#60270) =-= /* line one line 2 */ =-= /* line one line 2 */ =-=-= Name: Block Comment prefixes (Bug#61314) =-=-= /* - item1 - item2 - item3 */ =-=-= /* - item1 - item2 - item3 */ =-=-= Code: (lambda () (c-ts-mode) (setq-local indent-tabs-mode nil) (setq-local c-ts-mode-indent-offset 8) (c-ts-mode-set-style 'linux) (indent-region (point-min) (point-max))) Name: Labels (Linux Style) =-=-= int main (void) { label: return 0; if (true) { label: return 0; } else { if (true) { label: return 0; } } } =-=-= 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"); } else puts("Hello"); } =-=-= Name: Complicated mixed bracket matching indentation (bug#61142) =-= void foo( int foo) { for (;;) return 5; if (a == 0 && b == 1 && foo) { return 0; } else if (a == 1) { return 1; } else if (true) return 5; else { if (a == 0 && b == 1 && foo) for ( int i = 0; i < 5; i++) if (true) do i = 5; while (true); else if (false) { return 6; } else if (true && false) return 6; } } =-=-= Name: Block-Statement where first siblings are comments (Linux Style) =-= int main() { while (true) { /* foo */ if (true) { // bar puts ("Hello"); } } for (;;) { // 1. fooo /* 2. baaa */ /* 3. rrr */ if (true) // 2. baaa puts ("Hello"); } if (1) { // 1 /* * 2 */ if (1) /*3*/ { /* 4 */ puts("Hello"); } } } =-=-= Name: Initializer List (Linux Style) (Bug#61398) =-= int main() { const char *emoticons[][2] = { {":-)", "SLIGHTLY SMILING FACE"}, {";-)", "WINKING FACE"}, {":-(", "SLIGHTLY FROWNING FACE"}, }; } =-=-= Code: (lambda () (c++-ts-mode) (setq-local indent-tabs-mode nil) (setq-local c-ts-mode-indent-offset 2) (indent-region (point-min) (point-max))) Name: Declaration List (Namespace) (Bug#61635) =-= namespace test { class Name { }; } =-=-= Name: Namespace and template (bug#72263) =-= namespace A { T myfunction1(const char *fname) { } template T myfunction2(const char *fname) { } } =-= namespace A { T myfunction1(const char *fname) { } template T myfunction2(const char *fname) { } } =-=-= Name: Return Aggregate Initialized Struct =-= struct pair { int x, y; } pair make_pair(int long_identifier_a[], int long_identifier_b[], int offset_a, int offset_b) { int base_offset = 10; return { long_identifier_a[base_offset + offset_b], long_identifier_b[base_offset + offset_b] }; } =-= struct pair { int x, y; } pair make_pair(int long_identifier_a[], int long_identifier_b[], int offset_a, int offset_b) { int base_offset = 10; return { long_identifier_a[base_offset + offset_b], long_identifier_b[base_offset + offset_b] }; } =-=-= Code: (lambda () (c-ts-mode) (setq-local indent-tabs-mode nil) (setq-local c-ts-mode-indent-offset 2) (c-ts-mode-set-style 'gnu) (indent-for-tab-command)) Name: Empty Line =-= int main() { | } =-=-= Name: Empty Line Previous Sibling =-= int main() { int a = 1; | } =-=-= Name: Prev-Sibling But Not Trailing Comment =-= static int required_matrix_height (struct window *w) { #ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (f)) { return 0; } #endif /* Don't align to this comment. */ | } =-=-= Name: Empty Line =-= int main (void) { | } =-= int main (void) { | } =-=-= Name: Empty Line (Block Start) =-= int main (void) { | =-= int main (void) { | =-=-= Code: (lambda () (c-ts-mode) (setq-local indent-tabs-mode nil) (goto-line 3) (indent-for-tab-command)) Name: Block-Statement where previous sibling is comment =-= int main() { puts ("Hello"); // unusual indent and has trailing comment. return true; // Should align with previous non-comment sibling (rather than one level up against parent). } =-=-=