GNU bug report logs - #62717
29.0.60; c-ts-mode does not indent the first line in a function after RET

Previous Next

Package: emacs;

Reported by: Daniel Martín <mardani29 <at> yahoo.es>

Date: Fri, 7 Apr 2023 19:50:01 UTC

Severity: normal

Found in version 29.0.60

Full log


View this message in rfc822 format

From: Daniel Martín <mardani29 <at> yahoo.es>
To: 62717 <at> debbugs.gnu.org
Subject: bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET
Date: Fri, 07 Apr 2023 21:48:48 +0200
emacs -Q
C-x b sample.c RET
M-x c-ts-mode RET

int main() {

If I press RET at the end of the line, the point is not indented.

The Tree-sitter tree for the code is

(translation_unit
 (function_definition type: (primitive_type)
  declarator: 
   (function_declarator declarator: (identifier)
    parameters: (parameter_list ( )))
  body: (compound_statement { })))

If I insert a closing bracket, that is:

int main() {
}

The newline indents correctly.  The Tree-sitter tree is now

(function_definition type: (primitive_type)
 declarator: 
  (function_declarator declarator: (identifier)
   parameters: (parameter_list ( )))
 body: (compound_statement { }))

It seems that Tree-sitter parses both code snippets without errors and
Emacs should automatically indent after RET in the first case.




This bug report was last modified 2 years and 66 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.