summaryrefslogtreecommitdiff
path: root/lisp/progmodes/c-ts-mode.el
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2023-03-07 16:35:23 -0800
committerYuan Fu <casouri@gmail.com>2023-03-07 16:42:44 -0800
commitf9b7913656f9e4728a1140b61ddb7f07009e28e6 (patch)
tree0f98f734586cb9e76c2c225ef143369c04359192 /lisp/progmodes/c-ts-mode.el
parent90504f9d8982c12a033286fe06b40583f553d267 (diff)
downloademacs-f9b7913656f9e4728a1140b61ddb7f07009e28e6.tar.gz
emacs-f9b7913656f9e4728a1140b61ddb7f07009e28e6.tar.bz2
emacs-f9b7913656f9e4728a1140b61ddb7f07009e28e6.zip
Fix empty line indentation in c-ts-mode (bug#61997)
* lisp/progmodes/c-ts-mode.el: (c-ts-mode--indent-styles): Handle the empty line case. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test. * doc/lispref/modes.texi (Parser-based Indentation): Update manual. * lisp/treesit.el (treesit-simple-indent-presets): Support null as a value for NODE-TYPE in the 'match' matcher.
Diffstat (limited to 'lisp/progmodes/c-ts-mode.el')
-rw-r--r--lisp/progmodes/c-ts-mode.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 0b775b2d5c8..fdd962ff020 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -419,7 +419,9 @@ MODE is either `c' or `cpp'."
((parent-is "field_declaration_list") c-ts-mode--anchor-prev-sibling 0)
;; Statement in {} blocks.
- ((match nil "compound_statement" nil 1 1) standalone-parent c-ts-mode-indent-offset)
+ ((or (match nil "compound_statement" nil 1 1)
+ (match null "compound_statement"))
+ standalone-parent c-ts-mode-indent-offset)
((parent-is "compound_statement") c-ts-mode--anchor-prev-sibling 0)
;; Opening bracket.
((node-is "compound_statement") standalone-parent c-ts-mode-indent-offset)