From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#64818: 30.0.50; c++-ts-mode highlight does not work Date: Mon, 24 Jul 2023 19:13:07 +0200 Message-ID: <87mszl5j30.fsf@thornhill.no> References: <83sf9dsewi.fsf@gnu.org> <87ila9sann.fsf@thornhill.no> <834jlts9q0.fsf@gnu.org> <87pm4h5qk2.fsf@thornhill.no> <83wmypqokz.fsf@gnu.org> <9173CE5D-08AE-4BF3-AD37-3B521845F8AC@thornhill.no> <83pm4hqme2.fsf@gnu.org> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38022"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64818@debbugs.gnu.org, dianchengwang@gmail.com To: Eli Zaretskii , casouri@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jul 24 19:14:41 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1qNz8q-0009ej-Lt for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 24 Jul 2023 19:14:41 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNz8U-0007JE-CY; Mon, 24 Jul 2023 13:14:18 -0400 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 1qNz8F-0007D2-QL for bug-gnu-emacs@gnu.org; Mon, 24 Jul 2023 13:14:04 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qNz8E-00034U-VV for bug-gnu-emacs@gnu.org; Mon, 24 Jul 2023 13:14:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qNz8E-0005v4-Ck for bug-gnu-emacs@gnu.org; Mon, 24 Jul 2023 13:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Jul 2023 17:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64818 X-GNU-PR-Package: emacs Original-Received: via spool by 64818-submit@debbugs.gnu.org id=B64818.169021879522685 (code B ref 64818); Mon, 24 Jul 2023 17:14:02 +0000 Original-Received: (at 64818) by debbugs.gnu.org; 24 Jul 2023 17:13:15 +0000 Original-Received: from localhost ([127.0.0.1]:43918 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNz7S-0005tp-Vj for submit@debbugs.gnu.org; Mon, 24 Jul 2023 13:13:15 -0400 Original-Received: from out-40.mta0.migadu.com ([2001:41d0:1004:224b::28]:27253) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNz7O-0005te-K9 for 64818@debbugs.gnu.org; Mon, 24 Jul 2023 13:13:13 -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=1690218789; 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=tKG9wCbqCnk0HKklYqeaSNWSAO8MUWd8Ctr9HlHn/qM=; b=P2d+Ehw85VwqtPC+EM9nRc6o1cIjXD+s2KBLku1AwTSNK0rSWPfjOay11ZlZxH5x5rktBl A6ef8zbBxikJLLlwD23sRDuuN4GyXKAb4cmKOe01/Ti4t/LDac8PP1dSajMdT+4YmSADk5 kX9PDujqs1DWlZpJrfw8Xqx+cy5q8QcUa6DtwHEuDeiMleSDOX84vC/eIsZnIzTUHyk4No bOJDkhdYB6ocbrGkw5yQkRIMl4fqS1EzMsYgdRnsjuK5qmlP87kpPG8MkzIBMhusyWO0/a 79OAoUgKoCm72aSSLHxS6xCITTSuStbJHcyxufqQsgMZEOhOO0fEVByNBYwnQQ== In-Reply-To: <83pm4hqme2.fsf@gnu.org> X-Migadu-Flow: FLOW_OUT X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:265988 Archived-At: Eli Zaretskii writes: >> Date: Mon, 24 Jul 2023 18:40:44 +0200 >> From: Theodor Thornhill >> >> >> Yep, nullptr was changed from named node to unnamed node last week [0]. >> >> >> >> I think we can live without a compat change and only target the node >> >> as a normal keyword. I'll commit the fix if it is simple enough (the >> >> simplest is just to remove the node altogether), >> >> otherwise I'll send a patch for review. Sounds ok? >> > >> >I'd prefer to see the patch. Also, can you tell more about the effect >> >of the change you propose ("remove the node")? >> > >> >> In this case it will only make the symbol "nullptr" get no font locking. > > That's probably good enough. And CC Mode doesn't fontify it, either. > > Can you show the patch? > diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 7f4f6f11387..98797bf3ce7 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -574,9 +574,7 @@ c-ts-mode--font-lock-settings :feature 'constant `((true) @font-lock-constant-face (false) @font-lock-constant-face - (null) @font-lock-constant-face - ,@(when (eq mode 'cpp) - '((nullptr) @font-lock-constant-face))) + (null) @font-lock-constant-face) :language mode :feature 'keyword >> >More generally, I'm a bit worried by such incompatible changes in the >> >grammar libraries. The developers must understand that they break >> >users of tree-sitter, right? So why are they making such incompatible >> >changes? And how do other editors cope with such changes, for example >> >this one? >> >> An example from nvim-treesitter: https://github.com/nvim-treesitter/nvim-treesitter/commit/823e67a1c9452075ec7f01e7aa05ac6e7b41fb1e >> >> It seems most, if not all implementations use some sort of lockfile, where commits are frozen according to the current support. The consensus seems to be to do what I proposed some mails ago: show the last known commit the current file supports, and enable that one to be installed automatically. > > I'm not sure how we would maintain this data. Emacs is a large > project, and people come and go at will and without further notice. > We don't have people who will reliably track the development of the > grammar libraries and record the commits somewhere. We'd basically > need this when a release is being tarred, and for that it should be > recorded somewhere in advance. > Yeah, it's not a super simple problem. >> >I'm asking these questions because perhaps we are doing something we >> >shouldn't, or not doing something we should. I don't think we can >> >tell our users to use only a specific commit from the grammar >> >libraries' repositories: a significant portion of Emacs users tend to >> >switch to a new version many moons after the release (e.g., I see >> >reports from people who only now upgrade from Emacs 27 to Emacs 28, >> >more than a year since Emacs 28 was released). So a grammar library >> >which was the current one on the release date will be hopelessly >> >outdated by the time some users will switch to that Emacs version. >> > >> >So we must look for some more robust way, if it exists. >> >> I agree, but I'm not sure what that looks like. > > What about catching errors inside treesit.c or treesit.el, so that the > features that disappeared and queries that fail don't fail the entire > font-lock? Would that work, or at least make Emacs more robust in the > face of such changes? > > Yuan, WDYT? > > (This more robust approach is certainly not for Emacs 29.1, even if we > agree that it's a good idea.) I'll defer that to Yuan, as I'm not 100% on where such errors can be caught, and if it can make the parser enter some state it shouldn't be in. Theo