GNU bug report logs - #66845
29.1; cmake-ts-mode indentation broken

Previous Next

Package: emacs;

Reported by: Juan Palacios <jpalaciosdev <at> gmail.com>

Date: Tue, 31 Oct 2023 11:37:02 UTC

Severity: normal

Tags: patch

Found in version 29.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Fu Yuan <casouri <at> gmail.com>
To: Juan Palacios <jpalaciosdev <at> gmail.com>
Cc: Randy Taylor <dev <at> rjt.dev>, 66845 <at> debbugs.gnu.org
Subject: bug#66845: 29.1; cmake-ts-mode indentation broken
Date: Sun, 5 Nov 2023 10:16:02 -0800

> 在 2023年11月5日,上午6:33,Juan Palacios <jpalaciosdev <at> gmail.com> 写道:
> 
> El mié, 1 nov 2023 a las 3:45, Randy Taylor (<dev <at> rjt.dev>) escribió:
>> 
>>> On Tuesday, October 31st, 2023 at 07:35, Juan Palacios <jpalaciosdev <at> gmail.com> wrote:
>>> Using cmake grammar from https://github.com/uyha/tree-sitter-cmake
>>> 
>>> Reproduction:
>>> 1. emacs -q
>>> 2. C-x C-f test.cmake
>>> 3. M-x cmake-ts-mode
>>> 4. Insert the following text:
>>> if(TRUE)
>>> message("indent")
>>> endif()
>>> 5. Move the point to the beginning of the second line.
>>> 6. TAB
>>> 7. Notice that no indentation is performed.
>>> 
>>> treesit-simple-indent-rules local value:
>>> ((cmake
>>> ((node-is ")")
>>> parent-bol 0)
>>> ((node-is "else_command")
>>> parent-bol 0)
>>> ((node-is "elseif_command")
>>> parent-bol 0)
>>> ((node-is "endforeach_command")
>>> parent-bol 0)
>>> ((node-is "endfunction_command")
>>> parent-bol 0)
>>> ((node-is "endif_command")
>>> parent-bol 0)
>>> ((parent-is "foreach_loop")
>>> parent-bol cmake-ts-mode-indent-offset)
>>> ((parent-is "function_def")
>>> parent-bol cmake-ts-mode-indent-offset)
>>> ((parent-is "if_condition")
>>> parent-bol cmake-ts-mode-indent-offset)
>>> ((parent-is "normal_command")
>>> parent-bol cmake-ts-mode-indent-offset)))
>>> 
>>> treesit-explore-mode shows:
>>> (if_condition
>>> (if_command (if) (
>>> (argument_list
>>> (argument (unquoted_argument)))
>>> ))
>>> (body
>>> (normal_command (identifier) (
>>> (argument_list
>>> (argument
>>> (quoted_argument " (quoted_element) ")))
>>> )))
>>> (endif_command (endif) ( )))
>>> 
>> 
>> I've attached a patch fixing this while retaining compatibility with
>> older grammars. 2 new versions of the grammar, v0.3.0 and v0.4.0
>> (and anything beyond for now) wrap things in new nodes.
> 

Hey Randy,

I just see this, sorry :-) I’ll have a look tonight or tomorrow.

Yuan



This bug report was last modified 1 year and 195 days ago.

Previous Next


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