emacs-devel
[Top][All Lists]
Advanced

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

Re: feature/tree-sitter: Where to Put C/C++ Stuff


From: Theodor Thornhill
Subject: Re: feature/tree-sitter: Where to Put C/C++ Stuff
Date: Tue, 01 Nov 2022 14:05:39 +0100


On 1 November 2022 13:28:05 CET, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Theodor Thornhill <theo@thornhill.no>
>> Cc: emacs-devel@gnu.org, dev@rjt.dev, emacs-devel@gnu.org
>> Date: Tue, 01 Nov 2022 12:53:11 +0100
>> 
>> > I also have hard time believing that you can reimplement those slow
>> > parts of CC Mode to be much faster, but if you have code to show which
>> > does that, I'm sure I'd be interested to look at it and consider
>> > improving CC Mode using that code.
>> >
>> 
>> You'd be surprised.
>> 
>> - https://github.com/emacs-csharp/csharp-mode/pull/251
>> - https://github.com/emacs-csharp/csharp-mode/issues/207
>> - https://github.com/emacs-csharp/csharp-mode/issues/164
>> - https://debbugs.gnu.org/db/43/43631.html
>> - https://github.com/emacs-csharp/csharp-mode/issues/151
>> - https://github.com/emacs-csharp/csharp-mode/issues/200
>> 
>> All of these are solved with [0], no implementation needed for anything
>> (apart from generic tree-sitter machinery of course). 
>
>That's for C#, not for C/C++.
>
>But if you can do the same for C/C++, sure, let's see the code and
>judge its relative merits and demerits.
>
>> >> 3: Confusion with where to file bugs
>> >
>> > Not relevant in our case: the bugs should be filed with Emacs.
>> >
>> 
>> Well, are you sure?
>
>You asked where to file the bugs.  The answer is: on debbugs.  If it
>eventually turns out the bug is in tree-sitter, we will file a bug
>there.  Just like we do with any other library we use.  Nothing new
>here, IMO.
>
>> >  . filling and breaking text in comments and strings
>> >  . automatic insertion of newlines after braces, colons, commas, 
>> > semi-colons
>> >  . whitespace cleanups
>> >  . minor modes: electric, hungry-delete, comment-style
>> >  . c-offsets-alist and interactive indentation customization (related
>> >    to indentation, but still extremely important, and not directly in
>> >    tree-sitter)
>> >
>> 
>> Yes, I've read the manual many times.  Filling is one nice thing,
>> agreed.  electric, hungry-delete is just sitting there waiting for us to
>> create a framework using tree-sitter that would benefit _all_ languages
>> supported by tree-sitter, not just cc.
>
>If tree-sitter can make these easier or faster or better, I see no
>reason not to use tree-sitter for (some of) those features as well.
>There's no decision to limit tree-sitter's use to fontification and
>indentation, and I don't think we will ever make such decisions,
>except if we have some bitter experience.
>
>> > As they say, "show me the code".  If you can write up a C/C++ mode
>> > from scratch which supports most everything in the CC Mode manual, do
>> > it better/cleaner than CC Mode does, and do it before the emacs-29
>> > branch is cut, in a month or so, I might change my mind.
>> 
>> Challenge accepted.  Can I create it for java, which is a language I'm
>> writing a lot in these days?
>
>Sorry, no.  It has to support all the languages supported by CC Mode
>now.  That's the challenge.
>

Ok let's do it. But let's restrict it to languages considered stable from 
https://tree-sitter.github.io/tree-sitter/#available-parsers

- c
- c++
- c#
- java
- javascript
- typescript
- json

Ok? 

>It is fine by me to have a separate java-mode, but then I personally
>will not be very interested in this, since editing the Emacs C code,
>which I do a lot, will still need to use CC Mode.  Without decent
>support for C/C++, CC Mode cannot be retired.
>
>(Do people really use Emacs to develop Java?  I'd be surprised.)

Yes. I do, no problem

Theo 



reply via email to

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