From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71784: 31.0.50; Inconsistent fontification for field_identifier in c++-ts-mode Date: Thu, 27 Jun 2024 16:33:54 +0200 Message-ID: References: <87pls394h0.fsf.ref@aol.com> <87pls394h0.fsf@aol.com> Reply-To: Ergus Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27187"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71784@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 27 16:35:16 2024 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 1sMqDU-0006lF-LT for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 Jun 2024 16:35:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMqDP-0003fm-Pi; Thu, 27 Jun 2024 10:35:13 -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 1sMqDD-0003cd-6r for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2024 10:34:59 -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 1sMqDC-00077b-VB for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2024 10:34:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sMqDF-00066J-Rt for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2024 10:35:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ergus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Jun 2024 14:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71784 X-GNU-PR-Package: emacs Original-Received: via spool by 71784-submit@debbugs.gnu.org id=B71784.171949885623369 (code B ref 71784); Thu, 27 Jun 2024 14:35:01 +0000 Original-Received: (at 71784) by debbugs.gnu.org; 27 Jun 2024 14:34:16 +0000 Original-Received: from localhost ([127.0.0.1]:43089 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMqCV-00064r-DU for submit@debbugs.gnu.org; Thu, 27 Jun 2024 10:34:15 -0400 Original-Received: from sonic315-13.consmr.mail.bf2.yahoo.com ([74.6.134.123]:36752) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMqCS-00063y-Q3 for 71784@debbugs.gnu.org; Thu, 27 Jun 2024 10:34:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1719498841; bh=ctjH9F38/rsScJ1oA05r3JQ7rnJ2b26nbioHICbr5y4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=pmsouQkqe08LL+fshdnLlmX58hOAQCtH6gC0lQmkn+m+NyBqcqcFEW00O4LdyahtH1ieAZRZiXjl9AXdl6GAfub5JEuGE9/CZp+01YgcRK2HX4N1Clfh0igf+sH6smVj+72XThgWRQMlObY5cBg80N6xj3/DB/L9B9uKtHKqZCsUCy/EyvqXSlKiECFhTFdbZKxUJr+lM2YzOvE5U+dL9C68fuJs29F78VLfaT4Q7LIPl6w6xUi/e6fKxgr93jQSI1UFaxQsTqrNShn6wKEFDGtuBvbh7bJ0lMH7eLfUF+T5rBNm6UmkfkqqeKILZBa82NpiZUXY5HcX9Ou0a8Ojhg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1719498841; bh=jqf4f/F+2EYZLl4dHX/DsjB0QtppApc6dzCnCceVx79=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=FpYgbCiVg4AltQr17F01hVYbxUVu4qLLN1ycT2irjPkpr2dFzhJ6SYg6Cze8q5WEZ5h1EIuRyJyNHNfm21PEzu9sr85ZD5HDgK3+g9e240fNiF8hgMDWScBgjHqolmToOdkyIsPFRu0WYLKhUpYYAnun15DhaNS1s9cpg7a1YKnTXocu4QQEu3WqMxGc/WQhYsuCREoi34xzH1X/TlJusETVLJ8Asd6coMhPOloyyaBwhNabCjCOrHanVkB4o5bfqdvXAtIUaC0ZCdW/kLNX7VZ8jfV54eOTykkI6Vi0rjvZ6FyE3kFX8oRVN2yIr8y7qW50lCruekfifjLQn+VkwA== X-YMail-OSG: BSCV2G8VM1lYYKtMwDrxIY91OLvSVD8zxN5tq3rWMFebFB3_pPcCTal3H6q5ufK 6qZvZfAgDS..x9NmV7BLyl8vKPCBZ9ss.9h9C6beEe0gCZ68Yzrqtlb_cRLEfLeVoyhhdN5Y8ruW lhjj.XNBBnZiATCQYsLyOVuwnjlMiw1XVABQJQm8U3mAaFYbhkneZk8hIMoAumIuOx0UrfO.yeS3 VAYqFlTIiaHgi3ibdNfzsqSRc4.kYW76pduawO5AbNSP6rrBnDAe3i_wsgZ01LPxoo3W2MkuR9DA Q5p6BaglozMm3.Du6EUHZZMQj2W38QH.xRpopk9MUDnbcZp.IuB3TTu1pq.8N21ppyOYJrfcUW.P 1be436XnirjLFtI2otJzQ22Gzl0MLl93jxzMEVbDjJvChglpHz1YRHMy8_8H7Jq2nMVpwif4C5bA JdpJqXlfXRK0KL8G_FicFIu1kG.91GY6KSAYAB2uSifztzK.UIS9KkSK3QZWJh2kZ4PeITXYjsoO oCFBybJH.L_aZ0OeNojo03luKV2X0Ad1oyVPGN4LQcp_Sg4G4QrLnVwoxM4Ma74gVPNLXDwwZRN0 BnAagSy1ffW9gt_dxoK1yeuk.4e4G0JDk9lEfI8LDmFPLDByae8lrER5zUZ100XSJet5Hc_S_42g 2ELqze4mEqBWlQHgpaby643_hNl1VHUGeSXuqsxazh_aWCy.haKf3Ctv.Rjc1X4N9gjMkq.TaQ0k eCWAL5hrEEHYj1mC2RT4FWeNhbg2HTeAw0CMcYy73GMTUpcqu7VKqZiViGxC7CVq2UP0Inqcq6NQ 0e5Dth9gQkT3Wuly.z69LvBcH4DVUTT6OyprJ.zD2. X-Sonic-MF: X-Sonic-ID: dda9a1a5-0ce4-4b07-89b5-97264b5f9201 Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.bf2.yahoo.com with HTTP; Thu, 27 Jun 2024 14:34:01 +0000 Original-Received: by hermes--production-ir2-85cf877599-59p75 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 74ce5f1696122838d8ea78fa8bc630b3; Thu, 27 Jun 2024 14:33:55 +0000 (UTC) Content-Disposition: inline In-Reply-To: X-Mailer: WebService/1.1.22407 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol 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:288024 Archived-At: Hi Yuan: Very thanks for replying On Thu, Jun 27, 2024 at 12:16:13AM GMT, Yuan Fu wrote: > > >> On Jun 26, 2024, at 7:13 AM, Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: >> >> >> Hi: >> >> Using the c++-ts-mode I found that there is some inconsistent >> fontification for the `fields_identifier`: >> >> See the fontification in this example with `emacs -Q`. >> >> ```test.cpp >> >> std::string key; >> bool inserted; >> >> struct name_t { >> std::string key; >> bool inserted; >> }; >> >> name_t keys = {"aaa", true}; >> >> keys.inserted = false; >> bool a = keys.inserted; >> ``` >> >> 1. The `keys.inserted` values are shown differently before or after the >> = (the inserted word is fontified is some cases, but not in all) > >What’s the value of treesit-font-lock-level for you? If it’s 4, they >should be fontified the same. On level 3, only LHS is fontified. > You are right; it is 3 in my system. However I would expect that treesit-font-lock-level will be equivalent somehow to using font-lock-maximum-decoration with similar value. I think it is confusing having two different fontifications for the same variable due to their position. The colors are supposed to be a sort of hint or help for the programmer eyes; not just a decoration right? >> >> 2. The variable names are fontified differently outside or >> inside the struct. > >I mean, the “variable name” inside a structure is a field, not a >variable, so it makes sense that they are fontified >differently. Variable has font-lock-variable-name-face, field has >font-lock-field-name-face. Also variable and field face are the same in >the default theme, so they should look the same nevertheless. > Probably what annoys me is the difference with the previous behavior in this case. A field is also a variable in some sense for C++. There is not much difference with a variable in a namespace or a static variable in a class... Does it makes sense not to colorize these "field" and LHS on level 3 (like it used to be in c++-mode)? But put the new fontifications all together in level 4? In that way everything will be fontified in level 4 and will become immediately consistent. >> >> 3. The escape sequence (\t) is fontified differently to the rest of the >> text inside the string. I don't know if that is intentional or not. If >> it is intentional, just ignore this comment. > >Yeah it’s intentional. > Ok, good! Again, (just as a suggestion) it makes sense to move this new fontification to level 4 as well? >> >> The inconsistencies 1 and 2 are not only different to c++-mode but they >> are semantically incorrect. > >Yuan Just to mention: I am not wondering about the match/compatibility with c++-mode. I am only concerned about the semantic coherence of the fontification; which is supposed to be somehow helpful, not confusing. Thanks again, Best Ergus