unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Jason Vas Dias <jason.vas.dias@ptt.ie>
Cc: emacs-devel@gnu.org, jasson.vas.dias@gmail.com,
	jason.vas.dias@pttireland.ie, Eli Zaretskii <eliz@gnu.org>
Subject: Re: v29.2 Java FontLock mode weirdness ?
Date: Sun, 14 Jul 2024 20:39:56 +0000	[thread overview]
Message-ID: <ZpQ3nPftg830WVrz@ACM> (raw)
In-Reply-To: <hhr0bwkmxz.fsf@ptt.ie>

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).



  reply	other threads:[~2024-07-14 20:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-14 15:33 v29.2 Java FontLock mode weirdness ? Jason Vas Dias
2024-07-14 20:39 ` Alan Mackenzie [this message]
2024-07-15  2:24   ` Eli Zaretskii
2024-07-15 13:37     ` v29.4: Anomalous Highlighting in "Java//l Abbrev" (java-mode) Jason Vas Dias
2024-07-22 12:40   ` Bug#72126 fixed: v29.2 Java FontLock mode weirdness ? Alan Mackenzie
2024-07-26 13:26 ` bug#72126: closed (Bug#72126 fixed: v29.2 Java FontLock mode weirdness ?) Jason Vas Dias
2024-07-26 16:00   ` Alan Mackenzie
2024-07-27  0:52     ` Jason Vas Dias

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZpQ3nPftg830WVrz@ACM \
    --to=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jason.vas.dias@ptt.ie \
    --cc=jason.vas.dias@pttireland.ie \
    --cc=jasson.vas.dias@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).