emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 73168793c0 06/10: Fix label indentation for Linux style in c-ts


From: Yuan Fu
Subject: emacs-29 73168793c0 06/10: Fix label indentation for Linux style in c-ts-mode (bug#60543)
Date: Sat, 7 Jan 2023 21:44:44 -0500 (EST)

branch: emacs-29
commit 73168793c015d3da6b21bc96db784f9ef9225cbb
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    Fix label indentation for Linux style in c-ts-mode (bug#60543)
    
    Reference:
    1. https://www.gnu.org/software/indent/manual/indent/Common-styles.html
    2. https://www.gnu.org/software/indent/manual/indent/Option-Summary.html
    
    The GNU indent manual says Linux style should use -il1 flag, which
    means "indent labels to column 1".
    
    * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Indent label
    to column 1 in Linux style.
---
 lisp/progmodes/c-ts-mode.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 3463600bda..f58fac40ce 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -169,7 +169,9 @@ MODE is either `c' or `cpp'."
        ((match "while" "do_statement") parent 0)
        ,@common)
       (k&r ,@common)
-      (linux ,@common)
+      (linux
+       ((node-is "labeled_statement") point-min 1)
+       ,@common)
       (bsd
        ((parent-is "if_statement") parent-bol 0)
        ((parent-is "for_statement") parent-bol 0)



reply via email to

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