From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill Newsgroups: gmane.emacs.devel Subject: Re: cc-mode fontification feels random Date: Sat, 12 Jun 2021 07:20:00 +0200 Message-ID: References: <83im2lbqmv.fsf@gnu.org> <179f6e4fa40.2816.cc5b3318d7e9908e2c46732289705cb0@dancol.org> <83fsxpbpn9.fsf@gnu.org> <83k0n09tkp.fsf@gnu.org> <837dj09p0e.fsf@gnu.org> <20210611232535.b4dyu3a2yxvdixys@Ergus> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23813"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , dancol@dancol.org, acm@muc.de, rudalics@gmx.at, rms@gnu.org, emacs-devel@gnu.org To: Ergus , Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 12 07:20:52 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lrw4h-00060P-Ld for ged-emacs-devel@m.gmane-mx.org; Sat, 12 Jun 2021 07:20:52 +0200 Original-Received: from localhost ([::1]:47044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrw4g-0000Gn-I4 for ged-emacs-devel@m.gmane-mx.org; Sat, 12 Jun 2021 01:20:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrw47-0007uO-Pz for emacs-devel@gnu.org; Sat, 12 Jun 2021 01:20:16 -0400 Original-Received: from out0.migadu.com ([94.23.1.103]:28298) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrw41-0007aS-M6; Sat, 12 Jun 2021 01:20:15 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1623475202; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WEV9LQ49byR9bn9cf7FJlNTcLF666CxiXX58SvJWov8=; b=be0u0BwxEObpfvuEC0FFG+wYgrmvboIlQT3D4Mqtyjp40SHs5gtzjWvLnso8n2bH2koiom zk6ECcYzOWWCePA4EP4t3jyoPPsnYmVegvw68vqVMP8IRsiSziuPTqofpVP5SZBYbBk/t5 LjC+LDqA+dSJ7HNg7teh3OvosNGIr5WHYpHGFINK/4q3lc7Q8//gOiIZ1I5T4VdPfXqd0R +aSL7b21jshKANQsT0SvICV76HPwt4IgtmM69lzEJiKSW5sQ1H7DPfnjn2WtB6MUCQ5gVQ ZWfxJ3ggGxHTlV+rpzHaY9YRRG7SWMU1zLRX4WNh4WITsXj+8l5iHlIK0GH34A== In-Reply-To: <20210611232535.b4dyu3a2yxvdixys@Ergus> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: theo@thornhill.no Received-SPF: pass client-ip=94.23.1.103; envelope-from=theo@thornhill.no; helo=out0.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:270738 Archived-At: Ergus writes: > Going a bit more into this. And reconsidering tree-sitter. > > As there is already a tree-sitter module package with some interesting > functionalities. (I know Eli didn't like some details in it's > implementation) This module us used by csharp mode, in its own `csharp-tree-sitter-mode`, and uses these packages from melpa: - tree-sitter-mode - tree-sitter-langs - tree-sitter-indent This bug (https://github.com/emacs-csharp/csharp-mode/issues/164) is an even simpler test of the performance from CC Mode, which alan _is_ addressing right now, but should be interesting given this thread. csharp-mode grinds to a halt here, but csharp-tree-sitter-mode handles this perfectly. As for correctness there is no comparison. The tree sitter variant covers things that aren't even possible using CC Mode variant, like string interpolation, complicated, nested generics, preprocessor directives and much, much more. @Stefan - I'm not sure I understand what you mean by troublesome for elisp hackers. These grammars have a lisp-like dsl, and is pretty usable through C-M-x and defvars, see: https://github.com/emacs-csharp/csharp-mode/blob/master/csharp-tree-sitter.el#L44. IME experience it's not the same as normal elisp hacking, but it's good enough. That's only an opinion though. I don't understand why this shouldn't be doable? There could be an nongnu-ELPA package with defined grammars, and a way to download and compile parsers. As a side node, it is easy to design structural editing also, like `delete-defun` `change-in-string`, `beginning-and-end-of-defun` etc. Just take a small look at https://github.com/emacs-csharp/csharp-mode/blob/master/csharp-tree-sitter.el. These 410 lines covers way more than what CC Mode is atm. It would be *great* to move the tree sitter part to emacs. Just my two cents :) Theodor Thornhill