From unknown Thu Sep 11 05:48:42 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#18378 <18378@debbugs.gnu.org> To: bug#18378 <18378@debbugs.gnu.org> Subject: Status: wrong fontification of Java code Reply-To: bug#18378 <18378@debbugs.gnu.org> Date: Thu, 11 Sep 2025 12:48:42 +0000 retitle 18378 wrong fontification of Java code reassign 18378 emacs submitter 18378 Paul Pogonyshev severity 18378 minor tag 18378 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 01 05:48:26 2014 Received: (at submit) by debbugs.gnu.org; 1 Sep 2014 09:48:26 +0000 Received: from localhost ([127.0.0.1]:55400 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XOODp-00021J-Eu for submit@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 ) id 1XOODn-000214-G0 for submit@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 ) id 1XOODh-0003yO-Dn for submit@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 ) id 1XOODh-0003yK-AR for submit@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 ) id 1XOODg-0007EI-IJ for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2014 05:48:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOODf-0003xz-H6 for bug-gnu-emacs@gnu.org; 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 ) id 1XOODf-0003xu-Cx for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2014 05:48:15 -0400 Received: by mail-oa0-f46.google.com with SMTP id m19so3624475oag.33 for ; 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: Subject: wrong fontification of Java code From: Paul Pogonyshev To: bug-gnu-emacs@gnu.org 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@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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
class X
{
=C2=A0=C2=A0=C2=A0 public void x= ()
=C2=A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 f= or (int this_is_not_a_function_name : getX ()) {
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 }
=C2=A0=C2=A0=C2=A0 }
}

In curren= t trunk (compiled five minutes ago) 'this_is_not_a_function_name' a= bove is fontified as a function name. This seems to depend on whether I hav= e '()' after 'getX' or not.

Paul
--001a113483b4cfab880501fde6da-- From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 01 15:20:42 2014 Received: (at 18378) by debbugs.gnu.org; 1 Sep 2014 19:20:42 +0000 Received: from localhost ([127.0.0.1]:55887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XOX9d-0003OV-TB for submit@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 ) id 1XOX9a-0003OH-59 for 18378@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@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@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 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: [Patch] wrong fontification of Java code Message-Id: Date: Mon, 1 Sep 2014 15:20:30 -0400 To: 18378@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@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 +=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 =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)) From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 29 22:55:29 2019 Received: (at control) by debbugs.gnu.org; 30 Sep 2019 02:55:29 +0000 Received: from localhost ([127.0.0.1]:56419 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iElqT-0007LZ-KO for submit@debbugs.gnu.org; Sun, 29 Sep 2019 22:55:29 -0400 Received: from mail-pg1-f177.google.com ([209.85.215.177]:43257) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iElqP-0007L7-Eq for control@debbugs.gnu.org; Sun, 29 Sep 2019 22:55:27 -0400 Received: by mail-pg1-f177.google.com with SMTP id v27so6517433pgk.10 for ; Sun, 29 Sep 2019 19:55:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=++tXhfygGcCbnmpBiQMuSPFBom2UzGh8e0Yv3K1ZArw=; b=o3rmrHZ77EdTxXQWlYpMpU7TPzcqilysWGrbKyBsVyjSjONjvbuafGkIadepjXgjAU /Xq43ava4RLl8OGgkFGQLu3NRhONBV47gBi/L72ZMz7y2gERCJIZC03yNnKCpqyzLAHQ n5JFNE5tqmB9e7awaPnH2imwa8qNlitpLaqq3hgKJf3oAwVWILGWoWWWUCM17GHg9iJE jGAMdUGyb/ex0IxXnLzH9jWh6BZjMJarhWFZFsbeaSCG8TLMaN1dXkloZPKELCAxyO6u KHxBzlP4iOzeJUYmmj17FwzzRXPFo+hzRFlIdo4GwiHRCpC7UodmK1jY46LQEZ0mGag0 qQ4A== X-Gm-Message-State: APjAAAUf8gZFstjSFNUX0Uaj36uC+eZ2Yh83V9bKlyh3SMDCDPX248ma nOPZV9hM6sM34wayKt25v/SGTe1q6AC2OxE4zGXrFxVStvw= X-Google-Smtp-Source: APXvYqybgYDMJ5wGqug5Mzp2rSs+1jWFcNl6T1+W+0swt1sFt9ojp4650tdVozPZNkTg1HfHU4pWp1KSjO1qybLmpmA= X-Received: by 2002:a17:90a:1150:: with SMTP id d16mr24809663pje.2.1569812119239; Sun, 29 Sep 2019 19:55:19 -0700 (PDT) MIME-Version: 1.0 From: Stefan Kangas Date: Mon, 30 Sep 2019 04:55:08 +0200 Message-ID: Subject: To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tags 18378 + patch quit Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.215.177 listed in list.dnswl.org] 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 2.0 BLANK_SUBJECT Subject is present but empty X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) tags 18378 + patch quit From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 20 16:16:55 2020 Received: (at 18378) by debbugs.gnu.org; 20 Jan 2020 21:16:55 +0000 Received: from localhost ([127.0.0.1]:46178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1itePm-0007S9-TI for submit@debbugs.gnu.org; Mon, 20 Jan 2020 16:16:55 -0500 Received: from ted.gofardesign.uk ([67.225.143.91]:48470) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1itePl-0007O2-LO for 18378@debbugs.gnu.org; Mon, 20 Jan 2020 16:16:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Date:References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=PSnsXuOyJoYphKB+IUCzHvbuJR1Rx8QF3c7I0Exa/4w=; b=ONqRP23veRP8Aa73xe26suF6EQ wyRUTFDHDKg7f2ZsZs86JXJRJqROjikRKFQfXOZ80ULZ2kTK4yV6po2uwUttCH9fC4oXTS8pzGUWQ XlumS/Fe5jdsliVrVEF9auPOaFvMpz7NSdhLuLI8998c7iFnj+F54urJBgfA2ZBRxxOJHmPHg6mY5 IzSkUwlF5ZK2Arp+Z1a5vbXhPgoAYvlY5hxT1rkNrVUJSH/Ll9P6rY/UcYGTZwpkHphujS6zy96F6 h9H2IhX1wHAHq9XVGTL4BlsuaMKEIwpsxzO3dAjnlrKwmY2YQyyQLhVs2ysfzMllD+NsapP84aa+Y S5TPy5dQ==; Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:39308 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1itePf-000Ofp-Jm; Mon, 20 Jan 2020 16:16:47 -0500 From: Stefan Kangas To: Alan Mackenzie Subject: Re: bug#18378: [Patch] wrong fontification of Java code In-Reply-To: (Jordon Biondo's message of "Mon, 1 Sep 2014 15:20:30 -0400") References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Date: Mon, 20 Jan 2020 22:16:46 +0100 Message-ID: <87eevtq14x.fsf@marxist.se> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ted.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: ted.gofardesign.uk: stefan@marxist.se X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 18378 Cc: Jordon Biondo , 18378@debbugs.gnu.org, Paul Pogonyshev X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Alan, Could you please help review the below patch for cc-fonts.el? Thanks in advance. Best regards, Stefan Kangas Paul Pogonyshev 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 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 =E2=80=9C:=E2=80=9D can mark the = end of a declaration in > a foreach, not just a =E2=80=9C;=E2=80=9D or =E2=80=9C,=E2=80=9D. > > =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 > +=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 >=20=20=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)) From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 15:59:14 2020 Received: (at 18378) by debbugs.gnu.org; 22 Jan 2020 20:59:14 +0000 Received: from localhost ([127.0.0.1]:51436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iuN5m-0001Yr-7A for submit@debbugs.gnu.org; Wed, 22 Jan 2020 15:59:14 -0500 Received: from colin.muc.de ([193.149.48.1]:50340 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1iuN5j-0001Yi-Uh for 18378@debbugs.gnu.org; Wed, 22 Jan 2020 15:59:12 -0500 Received: (qmail 82123 invoked by uid 3782); 22 Jan 2020 20:59:10 -0000 Received: from acm.muc.de (p4FE15DC6.dip0.t-ipconnect.de [79.225.93.198]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 22 Jan 2020 21:59:06 +0100 Received: (qmail 31974 invoked by uid 1000); 22 Jan 2020 20:59:06 -0000 Date: Wed, 22 Jan 2020 20:59:06 +0000 To: Stefan Kangas Subject: Re: bug#18378: [Patch] wrong fontification of Java code Message-ID: <20200122205906.GC4319@ACM> References: <87eevtq14x.fsf@marxist.se> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87eevtq14x.fsf@marxist.se> User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 18378 Cc: Jordon Biondo , 18378@debbugs.gnu.org, Paul Pogonyshev X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Stefan. 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? I missed this bug report back in 2014. The code has moved around so much since then that Jordon's patch no longer applies. But a simple patch with the same idea appears to fix this bug: diff -r 3d883b66c245 cc-engine.el --- a/cc-engine.el Tue Jan 07 19:24:00 2020 +0000 +++ b/cc-engine.el Wed Jan 22 20:49:53 2020 +0000 @@ -9025,7 +9025,7 @@ (if (looking-at c-:-op-cont-regexp) (progn (goto-char (match-end 0)) t) (not - (and (c-major-mode-is 'c++-mode) + (and (c-major-mode-is '(c++-mode java-mode)) (save-excursion (and (c-go-up-list-backward) This patch should apply cleanly to the emacs-27 branch, and most probably to master, too. > Thanks in advance. > Best regards, > Stefan Kangas -- Alan Mackenzie (Nuremberg, Germany). > Paul Pogonyshev 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 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 > > + > > + * progmodes/cc-fonts.el (c-font-lock-declarators): Special > > + case for declarations inside Java foreach loops (Bug#18378) > > + > > 2014-09-01 Eli Zaretskii > > > > * 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)) From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 23 09:13:15 2020 Received: (at 18378) by debbugs.gnu.org; 23 Jan 2020 14:13:15 +0000 Received: from localhost ([127.0.0.1]:52010 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iudER-0007eZ-4u for submit@debbugs.gnu.org; Thu, 23 Jan 2020 09:13:15 -0500 Received: from ted.gofardesign.uk ([67.225.143.91]:53256) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iudEP-0007eL-2E for 18378@debbugs.gnu.org; Thu, 23 Jan 2020 09:13:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rUGr6AkQ0gXIzoKqwOvZ7XlomN+wTg31fbJqv9SALLA=; b=EBxrlAAz7X0OkDs4KlfBGd1dNs kQOuqkSgwBk96aLUXuIobjt70CcHaNTDnzeNBq2R5X02WG8Fj4SG16WCeHEUaoOqmDKHKPdB5DGRG KZzA6k4dp/1yzMZwJwXC/r/Yxu0pz/sN82VgynefRaOGQJhrdLAmIPpMSMubIxqJxnB5qYz3aCvMH 1dKHV1d4dakNwZngyyJ6zqhEETxr5/49rF8oSpfeHYzJbe2yFIQPdmaP2M1YNvRrGuJ8wS7G6w5AQ 8fzG4Sy/IT2/oUxcBnu5NO39IpxURdzA8nq2sPAj8VaqcOpdcIl1Vzd8oqMh495g+zG3b1BPEebsn nFt3uuwA==; Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:50180 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1iudEI-001HHc-RR; Thu, 23 Jan 2020 09:13:07 -0500 From: Stefan Kangas To: Alan Mackenzie Subject: Re: bug#18378: [Patch] wrong fontification of Java code In-Reply-To: <20200122205906.GC4319@ACM> (Alan Mackenzie's message of "Wed, 22 Jan 2020 20:59:06 +0000") References: <87eevtq14x.fsf@marxist.se> <20200122205906.GC4319@ACM> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Date: Thu, 23 Jan 2020 15:13:05 +0100 Message-ID: <87h80mgt1q.fsf@marxist.se> MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ted.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: ted.gofardesign.uk: stefan@marxist.se X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 18378 Cc: Jordon Biondo , 18378@debbugs.gnu.org, Paul Pogonyshev X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Alan, Alan Mackenzie writes: > I missed this bug report back in 2014. The code has moved around so > much since then that Jordon's patch no longer applies. But a simple > patch with the same idea appears to fix this bug: Thanks for taking a look. With your fix, applied on the master branch, in the example given: class X { public void x () { for (int this_is_not_a_function_name : getX ()) { } } } The "int" no longer has font-lock-type-face. Should it? Best regards, Stefan Kangas From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 23 13:09:52 2020 Received: (at 18378) by debbugs.gnu.org; 23 Jan 2020 18:09:52 +0000 Received: from localhost ([127.0.0.1]:53151 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iugvQ-0007AK-MH for submit@debbugs.gnu.org; Thu, 23 Jan 2020 13:09:52 -0500 Received: from colin.muc.de ([193.149.48.1]:16620 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1iugvO-0007AB-QT for 18378@debbugs.gnu.org; Thu, 23 Jan 2020 13:09:51 -0500 Received: (qmail 89747 invoked by uid 3782); 23 Jan 2020 18:09:48 -0000 Received: from acm.muc.de (p4FE15BF5.dip0.t-ipconnect.de [79.225.91.245]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 23 Jan 2020 19:09:47 +0100 Received: (qmail 31044 invoked by uid 1000); 23 Jan 2020 18:09:47 -0000 Date: Thu, 23 Jan 2020 18:09:47 +0000 To: Stefan Kangas Subject: Re: bug#18378: [Patch] wrong fontification of Java code Message-ID: <20200123180947.GA30959@ACM> References: <87eevtq14x.fsf@marxist.se> <20200122205906.GC4319@ACM> <87h80mgt1q.fsf@marxist.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87h80mgt1q.fsf@marxist.se> User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 18378 Cc: Jordon Biondo , 18378@debbugs.gnu.org, Paul Pogonyshev X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Stefan. On Thu, Jan 23, 2020 at 15:13:05 +0100, Stefan Kangas wrote: > Hi Alan, > Alan Mackenzie writes: > > I missed this bug report back in 2014. The code has moved around so > > much since then that Jordon's patch no longer applies. But a simple > > patch with the same idea appears to fix this bug: > Thanks for taking a look. > With your fix, applied on the master branch, in the example given: > class X > { > public void x () > { > for (int this_is_not_a_function_name : getX ()) { > } > } > } > The "int" no longer has font-lock-type-face. Should it? That's funny. It has font-lock-type-face for me, in all of emacs-27, master and standalone CC Mode (in master). font-lock-type-face is indeed correct, here. Are you sure you were .... (I don't think I need to fill in the dots for you. ;-) > Best regards, > Stefan Kangas -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 11 15:06:43 2020 Received: (at 18378) by debbugs.gnu.org; 11 Feb 2020 20:06:43 +0000 Received: from localhost ([127.0.0.1]:57595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j1bnv-0003Hr-5I for submit@debbugs.gnu.org; Tue, 11 Feb 2020 15:06:43 -0500 Received: from colin.muc.de ([193.149.48.1]:63130 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1j1bnt-0003Hi-As for 18378@debbugs.gnu.org; Tue, 11 Feb 2020 15:06:42 -0500 Received: (qmail 42557 invoked by uid 3782); 11 Feb 2020 20:06:39 -0000 Received: from acm.muc.de (p4FE15B78.dip0.t-ipconnect.de [79.225.91.120]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 11 Feb 2020 21:06:38 +0100 Received: (qmail 6693 invoked by uid 1000); 11 Feb 2020 20:06:38 -0000 Date: Tue, 11 Feb 2020 20:06:38 +0000 To: Stefan Kangas Subject: Re: bug#18378: [Patch] wrong fontification of Java code Message-ID: <20200211200638.GA6677@ACM> References: <87eevtq14x.fsf@marxist.se> <20200122205906.GC4319@ACM> <87h80mgt1q.fsf@marxist.se> <20200123180947.GA30959@ACM> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200123180947.GA30959@ACM> User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 18378 Cc: Jordon Biondo , 18378@debbugs.gnu.org, Paul Pogonyshev X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello again, Stefan. Ping? -- Alan Mackenzie (Nuremberg, Germany). On Thu, Jan 23, 2020 at 18:09:47 +0000, Alan Mackenzie wrote: > Hello, Stefan. > On Thu, Jan 23, 2020 at 15:13:05 +0100, Stefan Kangas wrote: > > Hi Alan, > > Alan Mackenzie writes: > > > I missed this bug report back in 2014. The code has moved around so > > > much since then that Jordon's patch no longer applies. But a simple > > > patch with the same idea appears to fix this bug: > > Thanks for taking a look. > > With your fix, applied on the master branch, in the example given: > > class X > > { > > public void x () > > { > > for (int this_is_not_a_function_name : getX ()) { > > } > > } > > } > > The "int" no longer has font-lock-type-face. Should it? > That's funny. It has font-lock-type-face for me, in all of emacs-27, > master and standalone CC Mode (in master). font-lock-type-face is indeed > correct, here. > Are you sure you were .... (I don't think I need to fill in the dots for > you. ;-) > > Best regards, > > Stefan Kangas > -- > Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 23 07:50:43 2020 Received: (at 18378-done) by debbugs.gnu.org; 23 Feb 2020 12:50:43 +0000 Received: from localhost ([127.0.0.1]:50512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j5qiY-0008WO-NG for submit@debbugs.gnu.org; Sun, 23 Feb 2020 07:50:42 -0500 Received: from colin.muc.de ([193.149.48.1]:52221 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1j5qiW-0008WE-B3 for 18378-done@debbugs.gnu.org; Sun, 23 Feb 2020 07:50:41 -0500 Received: (qmail 4733 invoked by uid 3782); 23 Feb 2020 12:50:38 -0000 Received: from acm.muc.de (p2E5D5A43.dip0.t-ipconnect.de [46.93.90.67]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 23 Feb 2020 13:50:37 +0100 Received: (qmail 10392 invoked by uid 1000); 23 Feb 2020 12:50:37 -0000 Date: Sun, 23 Feb 2020 12:50:37 +0000 To: Stefan Kangas Subject: Re: bug#18378: [Patch] wrong fontification of Java code Message-ID: <20200223125037.GA10370@ACM> References: <87eevtq14x.fsf@marxist.se> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87eevtq14x.fsf@marxist.se> User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 18378-done Cc: Jordon Biondo , 18378-done@debbugs.gnu.org, Paul Pogonyshev X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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 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 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 > > + > > + * progmodes/cc-fonts.el (c-font-lock-declarators): Special > > + case for declarations inside Java foreach loops (Bug#18378) > > + > > 2014-09-01 Eli Zaretskii > > * 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)) From unknown Thu Sep 11 05:48:42 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 23 Mar 2020 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator