From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: cc-mode fontification feels random Date: Sat, 12 Jun 2021 17:23:44 +0200 Message-ID: <20210612152344.4tyayrlk6ur7ujmt@Ergus> References: <837dj09p0e.fsf@gnu.org> <20210611232535.b4dyu3a2yxvdixys@Ergus> <87a6nw6jtf.fsf@telefonica.net> <20210612010844.45noqsg7wveeo3yw@Ergus> <83sg1n8t71.fsf@gnu.org> <20210612110103.u6kuh3d5vahxmxlt@Ergus> <83fsxn8gue.fsf@gnu.org> <20210612150402.5z2xpswor4dkxh7o@Ergus> <837diz866l.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13801"; mail-complaints-to="usenet@ciao.gmane.io" Cc: ofv@wanadoo.es, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 12 17:24:51 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 1ls5VC-0003P0-UE for ged-emacs-devel@m.gmane-mx.org; Sat, 12 Jun 2021 17:24:51 +0200 Original-Received: from localhost ([::1]:48544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ls5VB-0005gZ-I8 for ged-emacs-devel@m.gmane-mx.org; Sat, 12 Jun 2021 11:24:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55930) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ls5UN-00051i-RC for emacs-devel@gnu.org; Sat, 12 Jun 2021 11:23:59 -0400 Original-Received: from sonic301-2.consmr.mail.bf2.yahoo.com ([74.6.129.41]:44394) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ls5UI-00029D-CT for emacs-devel@gnu.org; Sat, 12 Jun 2021 11:23:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1623511431; bh=BG7NejjlEcgYJR/8C1pHXn24KxZ1PUshn2iSWHsaLo4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=MHjd1URGkQsWjL8pG/bZHekVcwnL+rtu/3bbO0VmsahHXBBXSHoJ5r0D5vKUoE8krMCZ2BnZ7LzoG3gj0gBu6e9us1OUtdrUbIMO0nUCbAfWBf9ZUDgruXaM05c6JOt22bbjKh2HmwHUgtEQ6IlNZ00dsPG61My8D4l6Oqsyz06GEHl6fNBaLaOJA4ON5e0Eisu/5YmGqaoQlfc4Rvy9SrFo4hxyvi61yEm+ZF0+8/SELpC6SaSVoJa4TX+OYyNMkSpC2Mq9nMLJbbtrFWAcGaTEs53oR7FEa+Z9OtSXxydldiJWIb0sAAqThCbf3PbXp7jpTXmjNp8WTZln5PqCaQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1623511431; bh=c8rDcSYjXRr6NAxdtwHhFXxLQ3j8TFagHuCP8mc91/e=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=V7ep1TQk3/sEd9htcTEXj6YRVp3Bhw+m44aHzj6ZC4NOkkDfZQERiYFRRRy4bCk8DE5oHNbfn6cUrSYdU0kJzC4A8E9B4y4r2dBjiQDNbeTd0i/O5tBhsJzPJ2SKTYKwtZyhdCY/swV2Zh594D3vOLHVFin2yIkE/arC9nMBO4sUFW5mbO+onJlk3oabaPa2HHdleFAky5S5LczJctjOiX2jL/BhY4EOGxxYBufWhtxZ/W2Z1CU/1nCsVL1XYIMRSVDJykZKRuebSbo6OgMJQ+xbgBW1zmfJGWGO79187AYxYXjOiEorHe91BFLghwaY91fKdOGOPqr4FmvvEoZaOQ== X-YMail-OSG: WyMD5rsVM1kilEAlQzBxwfeRy.48mxMQDmDmatvNIteSLShrf6.7wCiKzfHIuv3 E3QY.6P8FuTqHC1AWhWphqLHgr7KZTOMwMX6uVA0BOeu6ikmB50yO3eGvMdEt556wiIB5w14yiWN iTGiFBIjXhGy.dgT0hv1OJlbg_s1WbIOPzXBETaAmo.khZgazwbDrwk5MXtweR.1kUDhm1IFi92e xiyITOeiy3e18iXA.q3m6jg99GYvtUXzq8.sFngPgz8yE2_UEBJKi5XzOoI29UjL9phgT8k.JhKW erq6cf6KSdvTImJdFgngAOwojCQmyqYk6D30Nrji2tIjyaDpZ0DOn7y7IelscmYxXRitp2Fsn.xh zhT1P0ELsuiBjdG_Z.sKVZtXdr88cVo0iUOQROGcWxnymEyis7LIw.Sjjq.alJFGfQtWOhF0PNea _BkUJ4qHjVxm5EGtd7cS6eOBGi2FytbvWzcuLh_wcXjJ4GJbMgpKqfbjrQ7PED3FX_DyKwb5K54h AdPUnaocqF_Vax4ZqL3NFNnVvsy19xqOAFKwNVC54nf0l1VEhhWz.nbmV4HdDZ97clzGO2ILR7N. NPe_MEiSypAViotvlvhj04c4VY.srLgg20JtyPZr9FFYGv23Zfb8mvkgP61c.gua2eFYPCVOqPN4 qiL6ualcTyH5sLRQTKKOE1i5a_2XOPzRZUuZ.99TFnVdbGKCkLycbKlM3o9xzWYR1pSAwehF3XMS 6W5evWSdzs4DPqnMv0UuxsN10tu8I7RwiBhUPv01xeXI7zBr7Wo8EChj2yi1fWfK0_tXGbB73KPH WmOo1mhoewXGF8RHv.UxEInWLcc2loe0WCW7fVPEQJ X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.bf2.yahoo.com with HTTP; Sat, 12 Jun 2021 15:23:51 +0000 Original-Received: by kubenode549.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 60bc0d42d5469961186ea16e91988680; Sat, 12 Jun 2021 15:23:48 +0000 (UTC) Content-Disposition: inline In-Reply-To: <837diz866l.fsf@gnu.org> X-Mailer: WebService/1.1.18368 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.129.41; envelope-from=spacibba@aol.com; helo=sonic301-2.consmr.mail.bf2.yahoo.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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:270769 Archived-At: On Sat, Jun 12, 2021 at 06:16:02PM +0300, Eli Zaretskii wrote: >> Date: Sat, 12 Jun 2021 17:04:02 +0200 >> From: Ergus >> Cc: ofv@wanadoo.es, emacs-devel@gnu.org >> >> >> I see two approaches here: >> >> >> >> 1) add the tree-sitter properties/faces to the buffer text (fully or >> >> partially on the visible regions) >> >> >> >> 2) use the tree-sitter information directly from the tree and add the >> >> visible properties from there. >> >> >> >> This second one will require a more complete api of tree-sitter >> >> functions exposed to elisp, but in my opinion it worth it in accuracy, >> >> speed and simplicity (a single API to rule them all). And to support >> >> many languages we don't actually have like rust or the fancy C++ > 11. >> > >> >Why can't we have both? The information you are talking about, which >> >is needed by Emacs features other than fontification, can be used by >> >those other Emacs features when needed. You seem to be saying that >> >these two alternatives are mutually-exclusive, but you didn't explain >> >why. >> > >> They are not exclusive, but redundant. If we use the current >> infrastructure then we will spend a lot of time translating properties >> and contextual information. > >That depends on what you mean by "current infrastructure". > Properties, properties navigation. >> And avoiding to have part of them outdated. Navigation and >> indentation will continue to be based on properties we need to set >> and update all the time to make the match one by one. >> >> Basically we will be duplicating the information that is already in the >> tree. Creating many list objects, overloading the gc, and so on. So we >> potentially will save only the parsing time. > >Why would we do a silly thing like that? > to convert the tree into some lisp objects we can use with lisp functions (to check, read, compare and so on) >> The first one may work with a very primitive api to handle and iterate >> the tree-sitter tree. The second one will require to use cursors, >> finders and some other features from the tree-sitter API; improving >> performance for sure but replacing a lot of the work lisp is doing now. >> >> The second approach will probably make happy the C developers more than >> the Lisp ones. > >So where's the dilemma? > For me none, but lisp developers may not like to rely so much in an external library.