unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Kangas <stefan@marxist.se>
Cc: Jordon Biondo <jordonbiondo@gmail.com>,
	18378-done@debbugs.gnu.org,
	Paul Pogonyshev <pogonyshev@gmail.com>
Subject: bug#18378: [Patch] wrong fontification of Java code
Date: Sun, 23 Feb 2020 12:50:37 +0000	[thread overview]
Message-ID: <20200223125037.GA10370@ACM> (raw)
In-Reply-To: <87eevtq14x.fsf@marxist.se>

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





      parent reply	other threads:[~2020-02-23 12:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-01  9:48 bug#18378: wrong fontification of Java code Paul Pogonyshev
2014-09-01 19:20 ` bug#18378: [Patch] " Jordon Biondo
2020-01-20 21:16   ` Stefan Kangas
2020-01-22 20:59     ` Alan Mackenzie
2020-01-23 14:13       ` Stefan Kangas
2020-01-23 18:09         ` Alan Mackenzie
2020-02-11 20:06           ` Alan Mackenzie
2020-02-23 12:50     ` Alan Mackenzie [this message]

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=20200223125037.GA10370@ACM \
    --to=acm@muc.de \
    --cc=18378-done@debbugs.gnu.org \
    --cc=jordonbiondo@gmail.com \
    --cc=pogonyshev@gmail.com \
    --cc=stefan@marxist.se \
    /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).