From: Daniel Martín Date: Sun, 11 Dec 2022 14:57:43 +0000 (+0100) Subject: Align C++ access specifiers to their enclosing class/struct/union X-Git-Tag: emacs-29.0.90~1215 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d264b75669d;p=emacs.git Align C++ access specifiers to their enclosing class/struct/union (bug#59966) The default style in c++-mode aligns access specifiers like "private", "public" or "protected" to their enclosing class, struct, or union. The "ellemtel" style indents access specifiers, but this C++ style is not supported by c++-ts-mode yet. * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Align access specifiers to their enclosing class/struct/union. --- diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index deba83641b2..4cf06e10ebf 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -120,6 +120,8 @@ MODE is either `c' or `cpp'." ((query "(call_expression arguments: (_) @indent)") parent c-ts-mode-indent-offset) ((parent-is "call_expression") parent 0) ((parent-is "enumerator_list") parent-bol c-ts-mode-indent-offset) + ,@(when (eq mode 'cpp) + '(((node-is "access_specifier") parent-bol 0))) ((parent-is "field_declaration_list") parent-bol c-ts-mode-indent-offset) ((parent-is "initializer_list") parent-bol c-ts-mode-indent-offset) ((parent-is "if_statement") parent-bol c-ts-mode-indent-offset)