emacs-devel
[Top][All Lists]
Advanced

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

Re: Tree sitter support for C-like languages


From: Theodor Thornhill
Subject: Re: Tree sitter support for C-like languages
Date: Sat, 12 Nov 2022 07:16:40 +0100


On 12 November 2022 06:43:21 CET, Yuan Fu <casouri@gmail.com> wrote:
>
>
>> On Nov 10, 2022, at 10:01 PM, Theodor Thornhill <theo@thornhill.no> wrote:
>> 
>> Yuan Fu <casouri@gmail.com> writes:
>> 
>>>> On Nov 10, 2022, at 9:45 AM, Theodor Thornhill <theo@thornhill.no> wrote:
>>>> 
>>>> 
>>>> 
>>>> Hi all,
>>>> 
>>>> See the attached patch for support for several C-like languages.
>>>> 
>>>> They all support:
>>>> - Font locking
>>>> - Indentation (with styles for c/c++)
>>>> - Movement
>>>> - Imenu
>>>> - Which-func
>>>> 
>>>> These modes are meant as a supplement to tree-sitter.
>>>> 
>>>> I'm hopeful for some constructive criticism, and some testing.  This
>>>> patch needs to be applied to the feature/tree-sitter branch, and should
>>>> hopefully be applied there before we merge the branch to master, well
>>>> before Emacs 29 is cut.
>>>> 
>>>> I hope you like it,
>>>> 
>>>> Theo
>>> 
>>> This is fantastic! I’m trying them out right now :-)
>>> 
>>> Some things I noticed:
>>> 
>>> The indentation for the closing bracket of a struct is off:
>>> 
>>> struct regexp_cache
>>> {
>>>  struct regexp_cache *next;
>>>  };
>>> 
>> 
>> Yeah.
>> 
>>> Imenu has some duplicate entries, the patch below should fix that.
>>> 
>>> I also added the new contextual thingy to font-lock settings.
>> 
>> Thanks, added!
>> 
>> See below patch.  The struct issue was an ordering problem when I
>> extracted the styles.  Should be good now
>> 
>> Theo
>> 
>> <0001-Add-Tree-Sitter-modes-for-C-like-languages.patch>
>
>I noticed that with the default indent style, Emacs indents like this:
>
>int main () {
>              for (int j = 0; j < 5; j++)
>                a[j] = 3;
>              int i = 1;
>              swap(i, a[i+1]);
>              Point p = {0, 1};
>}
>
>int main ()
>{
>  for (int j = 0; j < 5; j++)
>    a[j] = 3;
>  int i = 1;
>  swap(i, a[i+1]);
>  Point p = {0, 1};
>}
>
>Is this expected?
>
>Yuan

The first one isn't gnu style, right? But it's an easy fix :)



reply via email to

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