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 09:11:38 +0000 Message-ID: References: <87edm52fu1.fsf@yahoo.com> <83cz1o3xso.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="14075"; 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 11:12: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 1qCGMa-0003Qz-1F for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Jun 2023 11:12:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCGML-0004lb-Vu; Thu, 22 Jun 2023 05:12:10 -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 1qCGMF-0004lC-Cm for bug-gnu-emacs@gnu.org; Thu, 22 Jun 2023 05:12:04 -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 1qCGME-0003io-Db for bug-gnu-emacs@gnu.org; Thu, 22 Jun 2023 05:12:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qCGMD-0001GQ-Sd for bug-gnu-emacs@gnu.org; Thu, 22 Jun 2023 05:12:01 -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 09:12:01 +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.16874251094834 (code B ref 64204); Thu, 22 Jun 2023 09:12:01 +0000 Original-Received: (at 64204) by debbugs.gnu.org; 22 Jun 2023 09:11:49 +0000 Original-Received: from localhost ([127.0.0.1]:34801 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qCGM0-0001Fs-Cl for submit@debbugs.gnu.org; Thu, 22 Jun 2023 05:11:48 -0400 Original-Received: from mx3.muc.de ([193.149.48.5]:58206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qCGLx-0001FZ-N8 for 64204@debbugs.gnu.org; Thu, 22 Jun 2023 05:11:46 -0400 Original-Received: (qmail 84768 invoked by uid 3782); 22 Jun 2023 11:11:39 +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 11:11:39 +0200 Original-Received: (qmail 14201 invoked by uid 1000); 22 Jun 2023 09:11:38 -0000 Content-Disposition: inline In-Reply-To: <83cz1o3xso.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:263868 Archived-At: Hello, Eli. On Thu, Jun 22, 2023 at 07:50:47 +0300, Eli Zaretskii wrote: > > Cc: acm@muc.de, 64204@debbugs.gnu.org > > Date: Wed, 21 Jun 2023 21:06:37 +0000 > > From: Alan Mackenzie > > Apologies, the patch I sent earlier was defective, not applying cleanly > > to the Emacs master branch. I also should have sent the patch as an > > attachment. > > I'm now sending the patch as attachment. It should apply cleanly to the > > master branch or emacs-29. > 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 don't think people are going to be putting $ signs at the start of identifiers by accident. CC Mode has always fontified $s in the middle (or at the end) of identifiers, and this doesn't seem to have caused problems. -- Alan Mackenzie (Nuremberg, Germany).