From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: cc-mode fontification feels random Date: Sat, 12 Jun 2021 18:06:44 +0300 Message-ID: <83a6nv86m3.fsf@gnu.org> References: <179f6e4fa40.2816.cc5b3318d7e9908e2c46732289705cb0@dancol.org> <83fsxpbpn9.fsf@gnu.org> <83k0n09tkp.fsf@gnu.org> <837dj09p0e.fsf@gnu.org> <20210611232535.b4dyu3a2yxvdixys@Ergus> <87a6nw6jtf.fsf@telefonica.net> <20210612010844.45noqsg7wveeo3yw@Ergus> <83sg1n8t71.fsf@gnu.org> <83bl8b88qz.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16721"; mail-complaints-to="usenet@ciao.gmane.io" Cc: ofv@wanadoo.es, spacibba@aol.com, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 12 17:07:54 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 1ls5Eo-0004At-2Z for ged-emacs-devel@m.gmane-mx.org; Sat, 12 Jun 2021 17:07:54 +0200 Original-Received: from localhost ([::1]:40814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ls5Em-0007uC-P4 for ged-emacs-devel@m.gmane-mx.org; Sat, 12 Jun 2021 11:07:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ls5Dr-0007D5-DO for emacs-devel@gnu.org; Sat, 12 Jun 2021 11:06:55 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:42700) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ls5Dq-0008IT-Jy; Sat, 12 Jun 2021 11:06:54 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2131 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ls5Dq-0004mQ-6l; Sat, 12 Jun 2021 11:06:54 -0400 In-Reply-To: (message from Stefan Monnier on Sat, 12 Jun 2021 10:33:59 -0400) 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:270767 Archived-At: > From: Stefan Monnier > Cc: spacibba@aol.com, ofv@wanadoo.es, emacs-devel@gnu.org > Date: Sat, 12 Jun 2021 10:33:59 -0400 > > The code is in `tree-sitter-hl.el`, where they define > `tree-sitter-hl-mode` which is enabled by `tree-sitter-hl--setup` > where they > > (add-function :override (local 'font-lock-fontify-region-function) > #'tree-sitter-hl--highlight-region) I've seen that, but it's full of FIXMEs that basically tell me this is incomplete and perhaps even kludgey? I don't really understand why the workarounds are needed (nor why font-lock-keywords would need to still be supported with TS). And I cannot say I'm happy with the uses of buffer-substring and the many conversions between character positions and byte positions. Maybe these could be cleaned up?