GNU bug report logs -
#997
perl-mode: Incorrect syntax highlighting for regex at top-level
Previous Next
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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 997 in the body.
You can then email your comments to 997 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#997
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
jidanni <at> jidanni.org
:
New bug report received and forwarded. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
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'/; #///
/\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;
$ 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"
Merged 997 26850.
Request was from
npostavs <at> users.sourceforge.net
to
control <at> debbugs.gnu.org
.
(Sun, 09 Jul 2017 18:51:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#997
; Package
emacs
.
(Sat, 29 Feb 2020 02:59:01 GMT)
Full text and
rfc822 format available.
Message #10 received at 997 <at> debbugs.gnu.org (full text, mbox):
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
Added tag(s) confirmed.
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Sat, 29 Feb 2020 02:59:02 GMT)
Full text and
rfc822 format available.
bug Marked as found in versions 28.0.50.
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Sat, 29 Feb 2020 02:59:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#997
; Package
emacs
.
(Sat, 29 Feb 2020 03:13:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 997 <at> debbugs.gnu.org (full text, mbox):
>>>>> "SK" == Stefan Kangas <stefan <at> marxist.se> writes:
SK> I tried inserting the problematic lines into a larger Perl file, but I
SK> couldn't reproduce the issue. I'm not sure if that means that the
SK> incorrect coloring only happens when these lines are inserted at the
SK> very beginning of a file.
Well I would just say 'See, reproducible!', and not test further
(e.g., beginning, end, middle of file.)
Forcibly Merged 997 26745 26850.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 16 Nov 2020 23:23:02 GMT)
Full text and
rfc822 format available.
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 16 Nov 2020 23:26:01 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 28.1, send any further explanations to
26850 <at> debbugs.gnu.org and 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 16 Nov 2020 23:26:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#997
; Package
emacs
.
(Tue, 17 Nov 2020 17:53:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 997 <at> debbugs.gnu.org (full text, mbox):
unmerge 997
reopen 997
thanks
So that's another attempt to exercise my super powers...
It turns out that 997, which had been merged with 26850, is actually a
different issue, and it is not fixed by the recent patch which
successfully dealt with Bug#26850 and Bug#26745 for Perl mode.
CPerl mode handles the examples correctly.
The issues are all related to each other because they all deal with the
difficulties to distinguish between a slash as a division sign and a
slash as a regex introduction. The apostrophe "'" is a red herring - it
increases the visibility of the bug, but isn't the root cause.
Right now, Perl mode tries to detect regexes based on what's before
them. Therefore, 26850 could be fixed by adding "return" to the stuff
which can occur before a regex. However, the examples in this bug
demonstrate regexes with *nothing* before them: Regular expressions can
start a statement just fine, they have a return value and set some
variables as side effects.
Correctly detecting "nothing" in a regex needs some care. So I'd like
to treat this as a separate bug which remains open for now.
--
Cheers,
haj
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#997
; Package
emacs
.
(Thu, 19 Nov 2020 16:09:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 997 <at> debbugs.gnu.org (full text, mbox):
haj <at> posteo.de (Harald Jörg) writes:
> unmerge 997
> reopen 997
> thanks
>
> So that's another attempt to exercise my super powers...
You have to send that text to control <at> debbugs.gnu.org in order for it to
take effect (generally if you do this as part of a public bug message,
you should use Bcc for that to avoid follow-ups from also going to
control; which is why you don't see that destination address when other
people do it).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#997
; Package
emacs
.
(Thu, 19 Nov 2020 17:08:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 997 <at> debbugs.gnu.org (full text, mbox):
unmerge 997
reopen 997
thanks
See my previous message for an explanation why I want to unmerge, and
Noam Postavsky's clarification (thank you!) why I'm sending this again,
now Bcc'ed to control <at> debbugs.gnu.org.
One day I'll be familiar enough with these procedures... I hope.
--
Cheers,
haj
Disconnected #997 from all other report(s).
Request was from
haj <at> posteo.de (Harald Jörg)
to
control <at> debbugs.gnu.org
.
(Thu, 19 Nov 2020 17:08:02 GMT)
Full text and
rfc822 format available.
bug No longer marked as fixed in versions 28.1 and reopened.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 19 Nov 2020 17:08:02 GMT)
Full text and
rfc822 format available.
Removed tag(s) fixed.
Request was from
haj <at> posteo.de (Harald Jörg)
to
control <at> debbugs.gnu.org
.
(Thu, 19 Nov 2020 19:34:02 GMT)
Full text and
rfc822 format available.
Changed bug title to 'perl-mode: Incorrect syntax highlighting for regex at top-level' from 'perl mode blows "'" etc.'
Request was from
haj <at> posteo.de (Harald Jörg)
to
control <at> debbugs.gnu.org
.
(Thu, 19 Nov 2020 21:25:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#997
; Package
emacs
.
(Mon, 19 Sep 2022 16:04:02 GMT)
Full text and
rfc822 format available.
Message #43 received at 997 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 997 patch
quit
haj <at> posteo.de (Harald Jörg) writes:
> Correctly detecting "nothing" in a regex needs some care. So I'd like
> to treat this as a separate bug which remains open for now.
I attach a patch to fix this bug, by detecting that we moved to the
beginning of buffer when searching for something before the "/".
[0001-perl-mode-is-a-regexp-match-if-there-s-nothing-befor.patch (text/x-patch, attachment)]
Added tag(s) patch.
Request was from
Mauro Aranda <maurooaranda <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Mon, 19 Sep 2022 16:04:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#997
; Package
emacs
.
(Mon, 19 Sep 2022 18:38:02 GMT)
Full text and
rfc822 format available.
Message #48 received at 997 <at> debbugs.gnu.org (full text, mbox):
Mauro Aranda <maurooaranda <at> gmail.com> writes:
> I attach a patch to fix this bug, by detecting that we moved to the
> beginning of buffer when searching for something before the "/".
Thanks; pushed to Emacs 29.
bug marked as fixed in version 29.1, send any further explanations to
997 <at> debbugs.gnu.org and jidanni <at> jidanni.org
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 19 Sep 2022 18:38:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 18 Oct 2022 11:24:13 GMT)
Full text and
rfc822 format available.
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.