From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#64204: C/C++ local variables not syntax highlighted if they start with $ Date: Thu, 22 Jun 2023 12:33:13 +0000 Message-ID: References: <87edm52fu1.fsf@yahoo.com> <83cz1o3xso.fsf@gnu.org> <83wmzv3iu0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34735"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, 64204@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 22 14:34:24 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 1qCJW3-0008ko-7d for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Jun 2023 14:34:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCJVp-0000B6-6W; Thu, 22 Jun 2023 08:34:09 -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 1qCJVj-00008G-CY for bug-gnu-emacs@gnu.org; Thu, 22 Jun 2023 08:34:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qCJVi-000896-Q2 for bug-gnu-emacs@gnu.org; Thu, 22 Jun 2023 08:34:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qCJVi-00010q-7V for bug-gnu-emacs@gnu.org; Thu, 22 Jun 2023 08:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Jun 2023 12:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64204 X-GNU-PR-Package: emacs Original-Received: via spool by 64204-submit@debbugs.gnu.org id=B64204.16874372033848 (code B ref 64204); Thu, 22 Jun 2023 12:34:02 +0000 Original-Received: (at 64204) by debbugs.gnu.org; 22 Jun 2023 12:33:23 +0000 Original-Received: from localhost ([127.0.0.1]:35120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qCJV4-0000zz-W5 for submit@debbugs.gnu.org; Thu, 22 Jun 2023 08:33:23 -0400 Original-Received: from mx3.muc.de ([193.149.48.5]:64898) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qCJV2-0000zk-KM for 64204@debbugs.gnu.org; Thu, 22 Jun 2023 08:33:21 -0400 Original-Received: (qmail 58582 invoked by uid 3782); 22 Jun 2023 14:33:14 +0200 Original-Received: from acm.muc.de (p4fe157eb.dip0.t-ipconnect.de [79.225.87.235]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 22 Jun 2023 14:33:13 +0200 Original-Received: (qmail 17322 invoked by uid 1000); 22 Jun 2023 12:33:13 -0000 Content-Disposition: inline In-Reply-To: <83wmzv3iu0.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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:263876 Archived-At: Hello, Eli. On Thu, Jun 22, 2023 at 13:13:59 +0300, Eli Zaretskii wrote: > > Date: Thu, 22 Jun 2023 09:11:38 +0000 > > Cc: luangruo@yahoo.com, 64204@debbugs.gnu.org > > From: Alan Mackenzie > > > Thanks, but shouldn't this be optional behavior, which users should be > > > able to control? Standard C disallows '$' in identifiers AFAIK, and > > > some users might wish to follow the Standard. > > The thing is, such an option would be difficult to implement. At the > > moment, c-symbol-start and c-symbol-key (regular expressions which match > > the start of an identifier and all of one) are calculated in cc-langs.el > > at compilation time. They are widely used (~40 times) in the indentation > > engine and fontification. > > It would be necessary to change these constants to variables, probably > > doubling the number of relevant c-lang-const's in cc-langs.el, and to add > > a mechanism to toggle between them at run time. > > I don't feel that the benefit from this new option would really be worth > > the work it would take to implement. > I do feel it's worth the effort. If we value correct fontification, > of course. I don't know what my opinions on this mean for you, but > there you have it. I cannot force you make this change, of course, I > can only try to convince. Having thought about this some more, maybe it's not such a big problem. The strategy I'm thinking about would not attempt to analyse identifiers with $ in them. Instead, it would amend only the fontification, with a new ad-hoc entry in font-lock-keywords which would go over all identifiers at the end of the fontification, and splat those containing a $ with font-lock-warning-face. I can see more problems arising when people start wanting to use identifiers with random Unicode characters in them. :-( -- Alan Mackenzie (Nuremberg, Germany).