GNU bug report logs - #997
perl-mode: Incorrect syntax highlighting for regex at top-level

Previous Next

Package: emacs;

Reported by: jidanni <at> jidanni.org

Date: Thu, 18 Sep 2008 13:25:04 UTC

Severity: minor

Tags: confirmed, patch

Found in versions 28.0.50, 27.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Kangas <stefan <at> marxist.se>
To: jidanni <at> jidanni.org
Cc: 997 <at> debbugs.gnu.org
Subject: bug#997: perl mode blows "'" etc.
Date: Sat, 29 Feb 2020 03:58:35 +0100
title 997 Incorrect perl-mode syntax highlighting in some cases (e.g. using "'")
tags 997 confirmed
found 997 28.0.50
thanks

jidanni <at> jidanni.org writes:

> Perl mode screws up bad with this file. Cperl mode gets it better.
> $ perl -c p.pl
> p.pl syntax OK
> $ cat p.pl
> /this is a perl program to demonstrate emacs's wacky color biz/;
> /this line is in the wrong color until here'/; #///

I can reproduce this on current master (28.0.50).

Open a file like this using perl-mode under emacs -Q to see the
incorrect highlighting:

/correct 'incorrect/;
/incorrect' correct/;

The problem goes away if the file looks like this instead:

$foo =~ /foobar/;
/correct 'incorrect/;
/incorrect 'correct/;

> /\b.*\bpic(ture)?s\b/;
> /this line is in the wrong color/;
> #this comment turns back on emacs correct color: \b\b
> /this line is in the right color/;
> /but not this line until the end\/;/m;

I see some incorrect highlighting in this example too.  Adding the
"$foo =~ /foobar/;" line from above seems to fix it here too.

> $ emacs -Q p.pl
> Anyway, one usually ends up having to stick in special comments with
> some / ; ` ' etc. in them lest large tracts of code become the wrong
> color. emacs-version "22.2.1"

I tried inserting the problematic lines into a larger Perl file, but I
couldn't reproduce the issue.  I'm not sure if that means that the
incorrect coloring only happens when these lines are inserted at the
very beginning of a file.

Best regards,
Stefan Kangas




This bug report was last modified 2 years and 246 days ago.

Previous Next


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