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: v29.2 Java FontLock mode weirdness ? Date: Sun, 14 Jul 2024 20:39:56 +0000 Message-ID: References: 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="21000"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, jasson.vas.dias@gmail.com, jason.vas.dias@pttireland.ie, Eli Zaretskii To: Jason Vas Dias Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jul 14 22:41:20 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 1sT624-0005K3-Lx for ged-emacs-devel@m.gmane-mx.org; Sun, 14 Jul 2024 22:41:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sT616-0005MF-0Q; Sun, 14 Jul 2024 16:40:20 -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 1sT614-0005LB-6n for emacs-devel@gnu.org; Sun, 14 Jul 2024 16:40:18 -0400 Original-Received: from mail.muc.de ([193.149.48.3]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sT612-000134-6K for emacs-devel@gnu.org; Sun, 14 Jul 2024 16:40:17 -0400 Original-Received: (qmail 33343 invoked by uid 3782); 14 Jul 2024 22:39:57 +0200 Original-Received: from muc.de (p4fe155ea.dip0.t-ipconnect.de [79.225.85.234]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 14 Jul 2024 22:39:57 +0200 Original-Received: (qmail 22404 invoked by uid 1000); 14 Jul 2024 20:39:56 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.3; 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_PASS=-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.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:321657 Archived-At: Hello, Jason. Thanks for taking the trouble to report this bug. However, for the next time, please submit the bug to bug-gnu-emacs (as Eli requested). Also, it would be easier to work with, in general, if you include the test case as source code, not just a picture. Thanks! On Sun, Jul 14, 2024 at 16:33:44 +0100, Jason Vas Dias wrote: > Good day - > Could anyone please enlighten me as to why, in enclosed Screenshot > of Emacs 29.2, running under Fedora 40 / XFce4 on x86_64, in Java, > the identifier after '>' in an 'if' clause is being specially highlighted , > but not one after '>=' ? ie. 'bursttime_end' identifier is shown in > green bold only when after a '>' character, not when after '>=' . Yes, this was a bug deep inside CC Mode, where the code was looking for a < ... > construct. In this case it failed to find it, but had already recorded bursttime_end as being a type. In the patch below, this type now gets removed before it can do any damage. > It looks like a bug to me, if only a niggle. Why doesn't this occur > in C font-lock mode ? There's special handling for Java Mode at the critical point which doesn't apply to C Mode. Anyhow, here's the patch. Please apply it to ..../lisp/progmodes/cc-engine.el in your Emacs directory, and then byte compile the patched file, then load it (or start Emacs afresh). Please test out the patched CC Mode with your real Java code, and confirm to me that the bug has indeed been fixed. If you want any help with the patching or byte compilation, feel free to send me private email. diff -r aba0055b21e4 cc-engine.el --- a/cc-engine.el Mon Jul 01 20:21:18 2024 +0000 +++ b/cc-engine.el Sun Jul 14 20:21:48 2024 +0000 @@ -8794,6 +8794,7 @@ ;; This function might do hidden buffer changes. (let ((start (point)) + (old-record-type-identifiers c-record-type-identifiers) (old-found-types (copy-hash-table c-found-types)) ;; If `c-record-type-identifiers' is set then activate ;; recording of any found types that constitute an argument in @@ -8830,7 +8831,8 @@ (nconc c-record-found-types c-record-type-identifiers))) t) - (setq c-found-types old-found-types) + (setq c-record-type-identifiers old-record-type-identifiers + c-found-types old-found-types) (goto-char start) nil)))) As for a bug report, please either submit one, or ask me to do so, and then I will. Eli: should I commit the fix to master or to the release branch? > Thanks, Best Regards, > Jason -- Alan Mackenzie (Nuremberg, Germany).