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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Paul Pogonyshev <pogonyshev@HIDDEN>; dated Mon, 1 Sep 2014 09:49:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 18378 <at> debbugs.gnu.org:


Received: (at 18378) by debbugs.gnu.org; 1 Sep 2014 19:20:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 01 15:20:42 2014
Received: from localhost ([127.0.0.1]:55887 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XOX9d-0003OV-TB
	for submit <at> debbugs.gnu.org; Mon, 01 Sep 2014 15:20:42 -0400
Received: from mail-ie0-f169.google.com ([209.85.223.169]:46990)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <jordonbiondo@HIDDEN>) id 1XOX9a-0003OH-59
 for 18378 <at> debbugs.gnu.org; Mon, 01 Sep 2014 15:20:40 -0400
Received: by mail-ie0-f169.google.com with SMTP id tr6so6614703ieb.28
 for <18378 <at> debbugs.gnu.org>; Mon, 01 Sep 2014 12:20:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=from:content-type:content-transfer-encoding:subject:message-id:date
 :to:mime-version;
 bh=KyE2B+hscIYi6jsPPd7Y9L79A3WkIDueSqJlKQnW0xU=;
 b=svX1NbSdrzLVDtaYBsdUrCirB1Aa4RR9W74DPK33NHRcUi2KJEuSlFJ24L875wf3gR
 al+9SJv1fmpyoKD2f2UHJkGQ7anVRjAFBW+oM7hGiq4OtTPEaVS6M+HGZpFOi7FKvDX3
 B0Jjp1N/AVcJU/EE5h89PivIAAnIYGOQ/3X9eYppbNv39+FBgduaqOnsOBWIBuFXUdhK
 HocN6sWO01GgBuq8wt+hmxVp5oKSurK02LQyaOPPDOdV18u6jIdSolIwGcXd57oSHy9t
 QLP3k+Q4XQdWJcSFkZtTV65FeT7YNXxX0r9+qPgojnROpDurGRaoPAqX3C59Fg/jDXb4
 l1WA==
X-Received: by 10.50.36.38 with SMTP id n6mr23312487igj.24.1409599232497;
 Mon, 01 Sep 2014 12:20:32 -0700 (PDT)
Received: from [192.168.0.4] ([216.150.236.84])
 by mx.google.com with ESMTPSA id ky8sm30734034igb.16.2014.09.01.12.20.31
 for <18378 <at> debbugs.gnu.org>
 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
 Mon, 01 Sep 2014 12:20:31 -0700 (PDT)
From: Jordon Biondo <jordonbiondo@HIDDEN>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
Subject: [Patch] wrong fontification of Java code
Message-Id: <CD43B703-83E4-47B9-A699-6BF435052CE9@HIDDEN>
Date: Mon, 1 Sep 2014 15:20:30 -0400
To: 18378 <at> debbugs.gnu.org
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\))
X-Mailer: Apple Mail (2.1878.2)
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 18378
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

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. =46rom 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 =93:=94 can mark the end of =
a declaration in a foreach, not just a =93;=94 or =93,=94.


=3D=3D=3D 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@HIDDEN>
+=20
+ 	* progmodes/cc-fonts.el (c-font-lock-declarators): Special
+ 	case for declarations inside Java foreach loops (Bug#18378)
+=20
  2014-09-01  Eli Zaretskii  <eliz@HIDDEN>
 =20
  	* ls-lisp.el (ls-lisp-use-string-collate)

=3D=3D=3D 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)\\|\\'\\|\\(=3D\\|\\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)\\|\\'\\|\\(=3D\\|"
!                                             (if (c-major-mode-is =
'java-mode)
!                                                 ":\\|"
!                                               "")
!                                             "\\s(\\)")
!                                     limit t t))
  		       (eq (char-before) ?\[)
  		       (c-go-up-list-forward))
  		     (setq brackets-after-id t))





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#18378; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 1 Sep 2014 09:48:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 01 05:48:26 2014
Received: from localhost ([127.0.0.1]:55400 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XOODp-00021J-Eu
	for submit <at> debbugs.gnu.org; Mon, 01 Sep 2014 05:48:25 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48097)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <pogonyshev@HIDDEN>) id 1XOODn-000214-G0
 for submit <at> debbugs.gnu.org; Mon, 01 Sep 2014 05:48:24 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <pogonyshev@HIDDEN>) id 1XOODh-0003yO-Dn
 for submit <at> debbugs.gnu.org; Mon, 01 Sep 2014 05:48:18 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM,
 HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:36541)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <pogonyshev@HIDDEN>) id 1XOODh-0003yK-AR
 for submit <at> debbugs.gnu.org; Mon, 01 Sep 2014 05:48:17 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49813)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <pogonyshev@HIDDEN>) id 1XOODg-0007EI-IJ
 for bug-gnu-emacs@HIDDEN; Mon, 01 Sep 2014 05:48:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <pogonyshev@HIDDEN>) id 1XOODf-0003xz-H6
 for bug-gnu-emacs@HIDDEN; Mon, 01 Sep 2014 05:48:16 -0400
Received: from mail-oa0-x22e.google.com ([2607:f8b0:4003:c02::22e]:52007)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <pogonyshev@HIDDEN>) id 1XOODf-0003xu-Cx
 for bug-gnu-emacs@HIDDEN; Mon, 01 Sep 2014 05:48:15 -0400
Received: by mail-oa0-f46.google.com with SMTP id m19so3624475oag.33
 for <bug-gnu-emacs@HIDDEN>; Mon, 01 Sep 2014 02:48:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:date:message-id:subject:from:to:content-type;
 bh=ZcE1YdKFGWxzUcNmkm7WijFBPOMBatvDtPEjF9OYHlI=;
 b=InOdrlDaiVdiWrM1Ka/rRCnEqycNn6LyJBb7FZuPCLnNH9nssz2QFDk0LBsAiuFQz2
 DxeLgBcZq3rXVBnwLOTWRSecffxrOTRY0U8xfd283QP0OnFkXX/ZuwJ/zvtZR5gsIBt6
 MU+bQEFcwD2OuVfxGUtL8qEzginXs3GnETHbJ5YgZR9dqifD8BLZLrkqWejJlrESNQ+e
 lPLM3E2ARvyKkclPX/tITUiadxlIt5zwGrYl+BFlWyK65o/QZsK6ZnYL21gke9QH52C3
 RPgnfgexYEm7QLOqp/40bApYYchEM/VWgFmUAKJjGIfFxPfE5Tzj/fCuhERnLs8N78Oa
 s1OQ==
MIME-Version: 1.0
X-Received: by 10.60.74.232 with SMTP id x8mr205245oev.84.1409564894275; Mon,
 01 Sep 2014 02:48:14 -0700 (PDT)
Received: by 10.182.125.5 with HTTP; Mon, 1 Sep 2014 02:48:14 -0700 (PDT)
Date: Mon, 1 Sep 2014 11:48:14 +0200
Message-ID: <CAG7BpapANoALOjrq_Dn73a8kOC9a7itfGu=sER0cruwLaHwSTQ@HIDDEN>
Subject: wrong fontification of Java code
From: Paul Pogonyshev <pogonyshev@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary=001a113483b4cfab880501fde6da
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

--001a113483b4cfab880501fde6da
Content-Type: text/plain; charset=UTF-8

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

--001a113483b4cfab880501fde6da
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div>class X<br>{<br>=C2=A0=C2=A0=C2=A0 public void x=
 ()<br>=C2=A0=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 f=
or (int this_is_not_a_function_name : getX ()) {<br>=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 }<br>=C2=A0=C2=A0=C2=A0 }<br>}<br><br></div>In curren=
t trunk (compiled five minutes ago) &#39;this_is_not_a_function_name&#39; a=
bove is fontified as a function name. This seems to depend on whether I hav=
e &#39;()&#39; after &#39;getX&#39; or not.<br>
<br></div>Paul<br></div>

--001a113483b4cfab880501fde6da--




Acknowledgement sent to Paul Pogonyshev <pogonyshev@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#18378; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

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