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: A few questions about c++-ts-mode. Date: Wed, 08 May 2024 16:35:52 +0300 Message-ID: <865xvoa0jr.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9360"; mail-complaints-to="usenet@ciao.gmane.io" Cc: spacibba@aol.com, emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed May 08 15:36:43 2024 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 1s4hTP-0002MR-G3 for ged-emacs-devel@m.gmane-mx.org; Wed, 08 May 2024 15:36:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s4hSj-0007NS-EA; Wed, 08 May 2024 09:36:01 -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 1s4hSf-0007LK-F8 for emacs-devel@gnu.org; Wed, 08 May 2024 09:35:58 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s4hSd-0008O0-KY; Wed, 08 May 2024 09:35:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=b3T81SPJ6ewfnNqKPXUisb3nHEuKl9l9dXqHuWwmh5Y=; b=V8r7DbMa1JCtlStIeAsM qqn+N+ayDbGe+PRaayIeEHpMDCuWlnB/SLyyMmH2Z0Pan4j6i8iAbuW4b3Buroqo+lsvD/8WIMLqO sMIlOwgSMe7+mlqIdcGH2vkoNch0cDPHTHwOQFwiCuS7WtIw6vyeLB6/NbhymPuf1m2i6t9cBL3WX l/nPYqKLDZAJAqrimIVJu6pl4wpsG3telmyG5UIR3NprWd9qrreCYp3cVqAp9G7Q1mjOIPpGmR9Ew dXuTqDyzMBgZXOpZv+glIIOhg1TExaKKDFlM1J/UWGW7q0JtmoISMGr85mCwUSQxoVKZxJkOM+RdE YSERwkiINmsxEw==; In-Reply-To: (message from Yuan Fu on Tue, 7 May 2024 17:19:53 -0700) 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:319005 Archived-At: > From: Yuan Fu > Date: Tue, 7 May 2024 17:19:53 -0700 > Cc: emacs-devel@gnu.org > > > 1. namespaces are not fontified like in c-mode (i.e in std::string the > > `std` used to have font-lock-constant-face while `string` used to have > > font-lock-type-face). It seems like tresitter identifies properly them > > like (namespace_identifier) and (type_identifier) > > Then we probably want to fontify namespaces in constant face. Or perhaps add a namespace-face that inherits from constant face. I think using font-lock-constant-face is fine. Patches welcome. > > 2. Doc string comments are fontified like normal comments. It looks like > > treesiter does not recognize them at all. Is this something we need to > > report to treesitter or we need to workaround it in emacs side? > > I’m working on that. I think the best way is to workaround it in Emacs. Please note that some of those specially-formatted comments are explicitly supported by the grammar. > > 3. macros like `#if defined(something)` fontifies the whole macro with > > same font (the `identifier` used to have no colors in c++-mode) > > We should update the fontification to leave out the identifier. We seem to have the technology already, but we are overwriting it? Observe: (preproc_defined) @font-lock-preprocessor-face (preproc_defined (identifier) @font-lock-variable-name-face) [,@c-ts-mode--preproc-keywords] @font-lock-preprocessor-face)