emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 d264b75669 4/9: Align C++ access specifiers to their enclosing


From: Yuan Fu
Subject: emacs-29 d264b75669 4/9: Align C++ access specifiers to their enclosing class/struct/union
Date: Mon, 12 Dec 2022 18:09:38 -0500 (EST)

branch: emacs-29
commit d264b75669d7d9d7ffe536a79af0ea34d8fd4b6a
Author: Daniel Martín <mardani29@yahoo.es>
Commit: Yuan Fu <casouri@gmail.com>

    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.
---
 lisp/progmodes/c-ts-mode.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index deba83641b..4cf06e10eb 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]