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: Tree sitter support for C-like languages Date: Fri, 11 Nov 2022 06:50:38 +0100 Message-ID: <7EDA89E3-2077-4C89-AB9B-002A2BB71E86@thornhill.no> References: <87tu36em9t.fsf@thornhill.no> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2841"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, casouri@gmail.com To: Randy Taylor Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 11 06:51:49 2022 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 1otMxA-0000XY-CK for ged-emacs-devel@m.gmane-mx.org; Fri, 11 Nov 2022 06:51:48 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otMwh-0000W1-Pk; Fri, 11 Nov 2022 00:51:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1otMwS-0000TF-Ge for emacs-devel@gnu.org; Fri, 11 Nov 2022 00:51:04 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1otMwQ-0000ej-IF for emacs-devel@gnu.org; Fri, 11 Nov 2022 00:51:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1668145857; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EHhkv8hxWeHckBOscqcK41MZzZgaStNF/6Fn7FviyNo=; b=QO863/tiTK6b0qba/5P5JhuAHGBo0rX7N1CdhatfyLLwC12t9+UeX2/fuIfmyOj8XTP2Vw JBSSndoSCREEUXeeFDJjLdzeYkxQB0mU1JrhvgPdZ6hO783IDO0dSik68CbRTtsXH8a2GM isTUWet4X186gWxibXdPkH0hC3Mvlx2aBtZVGKwCmoa9m9zttM94GJFcQ2tz9a8/2xsuHb teP7/JNao8xgqpIn7F8QdRoUpd1a8ILgx9OtnsctIgxmJb4sF1rYKX1c/LyFhumXCQAudP DPoFXrAkKulaJPmuY7VYSYv8cDrYpYzQmPEHUqY15oqb+YZH+2V6bsxVJOD9bQ== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-Reply-To: X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=188.165.223.204; envelope-from=theo@thornhill.no; helo=out2.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_PASS=-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.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299543 Archived-At: On 11 November 2022 01:43:27 CET, Randy Taylor wrote: >On Thursday, November 10th, 2022 at 12:45, Theodor Thornhill via "Emacs d= evelopment discussions=2E" wrote: > >>=20 >> Hi all, >>=20 >> See the attached patch for support for several C-like languages=2E >>=20 >> They all support: >> - Font locking >> - Indentation (with styles for c/c++) >> - Movement >> - Imenu >> - Which-func >>=20 >> These modes are meant as a supplement to tree-sitter=2E >>=20 >> I'm hopeful for some constructive criticism, and some testing=2E 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=2E >>=20 >> I hope you like it, >>=20 >> Theo > >Thanks Theo! I was actually just about to email you about this stuff=2E > >I will test drive the C and C++ stuff=2E > >A few comments: >- (This one is for everyone) For lists of things (like keywords, etc=2E) = and the font-lock rules, can we consider alphabetizing them (for the font-l= ock rules it would be by feature)? It would make them a lot easier to scan = for what's there/not there and give them some order (and we could then be c= onsistent everywhere)=2E I am happy to send a patch for this=2E >- I recently added some new font-lock faces for tree-sitter that you may = wish to make use of: http://git=2Esavannah=2Egnu=2Eorg/cgit/emacs=2Egit/com= mit/?h=3Dfeature/tree-sitter&id=3De06953b02a0e7b26b33c511a22896d0db4e5d63d > - I am happy to send a patch adding support for them=2E >- For my C++ configuration, my treesit font lock rules has 2 queries: one= for C and one for C++=2E The C one has all the usual C stuff, and the C++ = one has ONLY C++-related things=2E Could we do something similar here? That= would really reduce the duplication in the C++ file=2E Yeah, I'm interested in reducing duplication, but not for that reason only= =2E But I'm thinking of ways to make one inherit the other=2E How about we first get this merged, then new faces on top of that?