GNU bug report logs - #72126
v29.4: Anomalous Highlighting in "Java//l Abbrev" (java-mode)

Previous Next

Package: emacs;

Reported by: Jason Vas Dias <jason.vas.dias <at> ptt.ie>, jason.vas.dias <at> gmail.com

Date: Mon, 15 Jul 2024 16:47:02 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 72126 in the body.
You can then email your comments to 72126 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#72126; Package emacs. (Mon, 15 Jul 2024 16:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jason Vas Dias <jason.vas.dias <at> ptt.ie>, jason.vas.dias <at> gmail.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 15 Jul 2024 16:47:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Jason Vas Dias"<jason.vas.dias <at> ptt.ie>
To: bug-gnu-emacs <at> gnu.org
Cc: Alan Mackenzie <acm <at> muc.de>, Eli Zaretskii <eliz <at> gnu.org>,
 jason.vas.dias <at> gmail.com, jason.vas.dias <at> ptt.ie, emacs-devel <at> gnu.org
Subject: v29.4: Anomalous Highlighting in "Java//l Abbrev" (java-mode)
Date: Mon, 15 Jul 2024 14:37:00 +0100
[Message part 1 (text/plain, inline)]
 This was Subject: 'v29.2 Java FontLock mode weirdness ?' I sent to the
 'emacs-devel' list - opening Bug as requested by Eli.

  I have built Emacs 29.4, on Fedora 40 for x86_64, (using attached emacs.spec) ,
  and it has exactly the same problem in Java Mode as did 29.2, ie.
  with angle brackets in parenthesized expressions, eg.:

    boolean b =
            ( a < c );

  will result in c being highlighted in green bold, while

      
    boolean b =
            ( a <= c ) || ( d > c ) ;

   will not - please see attached Screenshot.

[Emacs-29.4-Java-FontLock-Anomaly-Screenshot_2024-07-15_14-15-02.png (image/png, attachment)]
[emacs.spec (application/octet-stream, attachment)]

Reply sent to Alan Mackenzie <acm <at> muc.de>:
You have taken responsibility. (Mon, 22 Jul 2024 12:41:02 GMT) Full text and rfc822 format available.

Notification sent to Jason Vas Dias <jason.vas.dias <at> ptt.ie>, jason.vas.dias <at> gmail.com:
bug acknowledged by developer. (Mon, 22 Jul 2024 12:41:02 GMT) Full text and rfc822 format available.

Message #10 received at 72126-done <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Jason Vas Dias <jason.vas.dias <at> ptt.ie>
Cc: 72126-done <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 jasson.vas.dias <at> gmail.com, jason.vas.dias <at> pttireland.ie, emacs-devel <at> gnu.org
Subject: Bug#72126 fixed: v29.2 Java FontLock mode weirdness ?
Date: Mon, 22 Jul 2024 12:40:22 +0000
Hello, Jason.

On Sun, Jul 14, 2024 at 20:39:56 +0000, Alan Mackenzie wrote:

[ .... ]

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

I'm taking it that the patch works OK.  I've committed it to the
emacs-30 release branch, from where it will find it way to the master
branch in the next few days (thanks to the volunteer who does this).

So I'm now closing the bug.  If that turns out to be a mistake, please
get back to us, so that we can reopen it.

[ .... ]

> >   Thanks, Best Regards,
> >   Jason
  
-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72126; Package emacs. (Fri, 26 Jul 2024 16:02:01 GMT) Full text and rfc822 format available.

Message #13 received at 72126 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Jason Vas Dias <jason.vas.dias <at> ptt.ie>, jason.vas.dias <at> gmail.com
Cc: acm <at> muc.de, Eli Zaretskii <eliz <at> gnu.org>, 72126 <at> debbugs.gnu.org,
 emacs-devel <at> gnu.org, jason.vas.dias <at> pttireland.ie
Subject: Re: bug#72126: closed (Bug#72126 fixed: v29.2 Java FontLock mode
 weirdness ?)
Date: Fri, 26 Jul 2024 16:00:48 +0000
[Message part 1 (text/plain, inline)]
Hello, Jason.

On Fri, Jul 26, 2024 at 14:26:37 +0100, Jason Vas Dias wrote:


> Good day Alan, Eli, all -

>   Thank you for submitting a patch for this - as you stated :

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

>   > I'm taking it that the patch works OK.  I've committed it to the
>   > emacs-30 release branch, from where it will find it way to the master
>   > branch in the next few days

>   I'd very much like to test your patch, ie. get an Emacs which fixes
>   this problem, which is most annoying when editing large amounts of Java.

>   But I could find no attached patch in any of your emails to me or on the bug
>   report.

The patch was actually inline in my email from 2024-07-14 rather than
being an attached file.  It is easier to read and comment on patches
this way unless they are big.  Normally, patch is good (in fact,
astoundingly good) at ignoring irrelevant text, so all you need to do is
save the email to a file ~/foo.patch, followed by

    $ cd .../lisp/progmodes
    $ patch < ~/foo.patch

..  However, I'm attaching the patch to this mail again, anyway.

>   Please could you send me either :
>    A) The patch, against Emacs 30 (devel branch) -
>       I can backport to v29.4  version

Will do.

>   or  
>    B) A link to the correct GIT repo, and a Commit Reference ID - again,
>       I can backport to v29.4

The commit to the emacs-30 branch was:

commit caf7426f0ca280b7cf40736e595cad8f7361152f (HEAD -> emacs-30)
Author: Alan Mackenzie <acm <at> muc.de>
Date:   Mon Jul 22 12:24:43 2024 +0000

    FIx spurious fontification of variable in Java Mode

>   or
>    C) The complete cc-engine.el from v29.4 with patch applied.

>   On receipt, I will test and let you know the results.

Thanks!

> Thank You & Best Regards,
> Jason

-- 
Alan Mackenzie (Nuremberg, Germany).

[diff.20240714.diff (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72126; Package emacs. (Fri, 26 Jul 2024 16:48:04 GMT) Full text and rfc822 format available.

Message #16 received at 72126-done <at> debbugs.gnu.org (full text, mbox):

From: "Jason Vas Dias"<jason.vas.dias <at> ptt.ie>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Eli Zaretskii <eliz <at> gnu.org>, jason.vas.dias <at> gmail.com, emacs-devel <at> gnu.org,
 72126-done <at> debbugs.gnu.org, jason.vas.dias <at> pttireland.ie
Subject: bug#72126: closed (Bug#72126 fixed: v29.2 Java FontLock mode
 weirdness ?)
Date: Fri, 26 Jul 2024 14:26:37 +0100

Good day Alan, Eli, all -

  Thank you for submitting a patch for this - as you stated :

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

  > I'm taking it that the patch works OK.  I've committed it to the
  > emacs-30 release branch, from where it will find it way to the master
  > branch in the next few days

  I'd very much like to test your patch, ie. get an Emacs which fixes
  this problem, which is most annoying when editing large amounts of Java.

  But I could find no attached patch in any of your emails to me or on the bug
  report.

  Please could you send me either :
   A) The patch, against Emacs 30 (devel branch) -
      I can backport to v29.4  version
  or  
   B) A link to the correct GIT repo, and a Commit Reference ID - again,
      I can backport to v29.4
  or
   C) The complete cc-engine.el from v29.4 with patch applied.

  On receipt, I will test and let you know the results.

Thank You & Best Regards,
Jason

   
  




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72126; Package emacs. (Sat, 27 Jul 2024 07:21:02 GMT) Full text and rfc822 format available.

Message #19 received at 72126-done <at> debbugs.gnu.org (full text, mbox):

From: "Jason Vas Dias"<jason.vas.dias <at> ptt.ie>
To: Alan Mackenzie <acm <at> muc.de>
Cc: jason.vas.dias <at> gmail.com, jason.vas.dias <at> ptt.ie, emacs-devel <at> gnu.org,
 72126-done <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 jason.vas.dias <at> pttireland.ie
Subject: bug#72126: closed (Bug#72126 fixed: v29.2 Java FontLock mode
 weirdness ?)
Date: Sat, 27 Jul 2024 01:52:38 +0100

Yes, thank you Alan, that fixed it ! :

# diff -U1 cc-engine.el~ cc-engine.el
--- cc-engine.el~	2024-06-21 14:09:32.000000000 +0100
+++ cc-engine.el	2024-07-27 01:38:10.486395403 +0100
@@ -8525,3 +8525,4 @@
 
-  (let ((start (point))
+ (let ((start (point))
+       	(old-record-type-identifiers c-record-type-identifiers)
 	(old-found-types (copy-hash-table c-found-types))
@@ -8562,3 +8563,4 @@
 
-	(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)

[root <at> jvdspc:/usr/share/emacs/29.4/lisp/progmodes [4474] 01:45:06 #:79!:35920]{1}
# emacs --batch -l comp -f batch-byte+native-compile cc-engine.el 
... OK

I then loaded /tmp/a.java:

class a {

    public void f() {
        int a = ( b < c ) 
    }
}

and c is no longer green !

Thank you, Best Regards

Jason




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 24 Aug 2024 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 72 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.