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: Wed, 28 Jun 2023 18:45:09 +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="30464"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, acm@muc.de, 64204-done@debbugs.gnu.org To: Eli Zaretskii , Joseph Garvin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 28 20:46:23 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 1qEaBL-0007is-7W for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 28 Jun 2023 20:46:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEaB4-0000IZ-G0; Wed, 28 Jun 2023 14:46:06 -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 1qEaB1-0000H2-D0 for bug-gnu-emacs@gnu.org; Wed, 28 Jun 2023 14:46:03 -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 1qEaB1-0004Cb-3T for bug-gnu-emacs@gnu.org; Wed, 28 Jun 2023 14:46:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qEaB0-0004NB-Vp for bug-gnu-emacs@gnu.org; Wed, 28 Jun 2023 14:46:02 -0400 Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Jun 2023 18:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 64204 X-GNU-PR-Package: emacs Mail-Followup-To: 64204@debbugs.gnu.org, acm@muc.de, k04jg02@gmail.com Original-Received: via spool by 64204-done@debbugs.gnu.org id=D64204.168797791916733 (code D ref 64204); Wed, 28 Jun 2023 18:46:02 +0000 Original-Received: (at 64204-done) by debbugs.gnu.org; 28 Jun 2023 18:45:19 +0000 Original-Received: from localhost ([127.0.0.1]:51706 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qEaAI-0004Lo-NT for submit@debbugs.gnu.org; Wed, 28 Jun 2023 14:45:19 -0400 Original-Received: from mx3.muc.de ([193.149.48.5]:53969) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qEaAH-0004Lc-01 for 64204-done@debbugs.gnu.org; Wed, 28 Jun 2023 14:45:17 -0400 Original-Received: (qmail 6247 invoked by uid 3782); 28 Jun 2023 20:45:11 +0200 Original-Received: from acm.muc.de (p4fe155d3.dip0.t-ipconnect.de [79.225.85.211]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 28 Jun 2023 20:45:10 +0200 Original-Received: (qmail 18856 invoked by uid 1000); 28 Jun 2023 18:45:09 -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:264235 Archived-At: Hello, Joseph and 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. :-) OK, the fontification of identifiers with $ is now working. By default they are fontified as normal identifiers (i.e. with font-lock-type-face, font-lock-variable-name-face, or font-lock-function-name-face), but if the (new) customisable option c-warn-ids-with-dollar is set to non-nil, font-lock-warning-face is used instead. The above applies only to C, C++, and Objective C Modes, and to any derived modes which enable the mechanism. So, I'm closing the bug now with this post. -- Alan Mackenzie (Nuremberg, Germany).