GNU bug report logs - #18378
wrong fontification of Java code

Previous Next

Package: emacs;

Reported by: Paul Pogonyshev <pogonyshev <at> gmail.com>

Date: Mon, 1 Sep 2014 09:49:02 UTC

Severity: minor

Tags: patch

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Pogonyshev <pogonyshev <at> gmail.com>
Subject: bug#18378: closed (Re: bug#18378: [Patch] wrong fontification of
 Java code)
Date: Sun, 23 Feb 2020 12:51:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#18378: wrong fontification of Java code

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 18378 <at> debbugs.gnu.org.

-- 
18378: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18378
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Alan Mackenzie <acm <at> muc.de>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: Jordon Biondo <jordonbiondo <at> gmail.com>, 18378-done <at> debbugs.gnu.org,
 Paul Pogonyshev <pogonyshev <at> gmail.com>
Subject: Re: bug#18378: [Patch] wrong fontification of Java code
Date: Sun, 23 Feb 2020 12:50:37 +0000
Hello, all.

I've committed a fix to this bug to the emacs-27 branch at savannah.
I'm closing the bug with this post.

-- 
Alan Mackenzie (Nuremberg, Germany).


On Mon, Jan 20, 2020 at 22:16:46 +0100, Stefan Kangas wrote:
> Hi Alan,

> Could you please help review the below patch for cc-fonts.el?

> Thanks in advance.

> Best regards,
> Stefan Kangas

> Paul Pogonyshev <pogonyshev <at> gmail.com> writes:

> > class X
> > {
> >     public void x ()
> >     {
> >         for (int this_is_not_a_function_name : getX ()) {
> >         }
> >     }
> > }

> > In current trunk (compiled five minutes ago)
> > 'this_is_not_a_function_name' above is fontified as a function
> > name. This seems to depend on whether I have '()' after 'getX' or
> > not.

> > Paul

> Jordon Biondo <jordonbiondo <at> gmail.com> writes:

> > I have a potential solution for this bug, as it has impacted me as well.

> > Not sure what the best solution would be but I have included a patch that does
> > solve the problem. From what I can tell there are no tests for java
> > fortification but I have not seen any issues arising in my own java
> > projects. The issue was that in java, a “:” can mark the end of a declaration in
> > a foreach, not just a “;” or “,”.

> > === modified file 'lisp/ChangeLog'
> > *** lisp/ChangeLog	2014-09-01 15:03:45 +0000
> > --- lisp/ChangeLog	2014-09-01 19:11:46 +0000
> > ***************
> > *** 1,3 ****
> > --- 1,8 ----
> > + 2014-09-01  Jordon Biondo  <jordonbiondo <at> gmail.com>
> > + 
> > + 	* progmodes/cc-fonts.el (c-font-lock-declarators): Special
> > + 	case for declarations inside Java foreach loops (Bug#18378)
> > + 
> >   2014-09-01  Eli Zaretskii  <eliz <at> gnu.org>

> >   	* ls-lisp.el (ls-lisp-use-string-collate)

> > === modified file 'lisp/progmodes/cc-fonts.el'
> > *** lisp/progmodes/cc-fonts.el	2014-08-24 20:50:11 +0000
> > --- lisp/progmodes/cc-fonts.el	2014-09-01 19:11:59 +0000
> > *************** casts and declarations are fontified.  U
> > *** 1116,1123 ****
> >   	    ;; initializing brace lists.
> >   	    (let (found)
> >   	      (while
> > ! 		  (and (setq found (c-syntactic-re-search-forward
> > ! 			     "[;,]\\|\\s)\\|\\'\\|\\(=\\|\\s(\\)" limit t t))
> >   		       (eq (char-before) ?\[)
> >   		       (c-go-up-list-forward))
> >   		     (setq brackets-after-id t))
> > --- 1116,1128 ----
> >   	    ;; initializing brace lists.
> >   	    (let (found)
> >   	      (while
> > !                   (and (setq found (c-syntactic-re-search-forward
> > !                                     (concat "[;,]\\|\\s)\\|\\'\\|\\(=\\|"
> > !                                             (if (c-major-mode-is 'java-mode)
> > !                                                 ":\\|"
> > !                                               "")
> > !                                             "\\s(\\)")
> > !                                     limit t t))
> >   		       (eq (char-before) ?\[)
> >   		       (c-go-up-list-forward))
> >   		     (setq brackets-after-id t))

[Message part 3 (message/rfc822, inline)]
From: Paul Pogonyshev <pogonyshev <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: wrong fontification of Java code
Date: Mon, 1 Sep 2014 11:48:14 +0200
[Message part 4 (text/plain, inline)]
class X
{
    public void x ()
    {
        for (int this_is_not_a_function_name : getX ()) {
        }
    }
}

In current trunk (compiled five minutes ago) 'this_is_not_a_function_name'
above is fontified as a function name. This seems to depend on whether I
have '()' after 'getX' or not.

Paul
[Message part 5 (text/html, inline)]

This bug report was last modified 5 years and 173 days ago.

Previous Next


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