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.devel Subject: Re: cc-mode fontification feels random Date: Sun, 6 Jun 2021 11:53:14 +0000 Message-ID: References: <75162ded-1ae5-6a12-f730-691edb96e5e0@yandex.ru> 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="26324"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Daniel Colascione , emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jun 06 13:54:07 2021 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 1lprLz-0006VL-75 for ged-emacs-devel@m.gmane-mx.org; Sun, 06 Jun 2021 13:54:07 +0200 Original-Received: from localhost ([::1]:56230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lprLy-0002tG-6C for ged-emacs-devel@m.gmane-mx.org; Sun, 06 Jun 2021 07:54:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lprLG-0002Cq-1C for emacs-devel@gnu.org; Sun, 06 Jun 2021 07:53:22 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:17583 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1lprLC-0005iA-IA for emacs-devel@gnu.org; Sun, 06 Jun 2021 07:53:21 -0400 Original-Received: (qmail 2288 invoked by uid 3782); 6 Jun 2021 11:53:15 -0000 Original-Received: from acm.muc.de (p2e5d5696.dip0.t-ipconnect.de [46.93.86.150]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 06 Jun 2021 13:53:15 +0200 Original-Received: (qmail 6283 invoked by uid 1000); 6 Jun 2021 11:53:14 -0000 Content-Disposition: inline In-Reply-To: <75162ded-1ae5-6a12-f730-691edb96e5e0@yandex.ru> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:270473 Archived-At: Hello, Dmitry. On Sat, Jun 05, 2021 at 23:25:41 +0300, Dmitry Gutov wrote: > On 04.06.2021 18:54, Alan Mackenzie wrote: > > Whether a type is recognised as such depends on that, yes. It's hard to > > think of a better way without having the resources of a compiler, > > particularly for ill-behaved languages like C+ > Would it work much worse if you took the approach of not applying the > highlighting when you frequently cannot be sure of what the type of the > term is? Cases of "not being sure" are common indeed. The whole of CC Mode is based on heuristics. > That would mean none of the types in brackets would be highlighted in > the original example, but perhaps that is still better than the current > result? That would mean adding complicated decision functions for "not being sure". If the fontification of types where they are used (as opposed to being declared) were to become less common, people would notice and complain too. There's the idea I proposed in my post to Daniel C of today - when a type is newly recognised, then go through the buffer fontifying occurrences of it. That would probably help a lot, possibly at the cost of slowing the mode down a bit. -- Alan Mackenzie (Nuremberg, Germany).