GNU bug report logs -
#30549
25.2; perl-mode: font lock improvement
Previous Next
Reported by: Evgeni Kolev <evgeni.d.kolev <at> gmail.com>
Date: Tue, 20 Feb 2018 16:21:02 UTC
Severity: minor
Tags: patch
Found in version 25.2
Done: Eli Zaretskii <eliz <at> gnu.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 30549 in the body.
You can then email your comments to 30549 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#30549
; Package
emacs
.
(Tue, 20 Feb 2018 16:21:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Evgeni Kolev <evgeni.d.kolev <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 20 Feb 2018 16:21:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I'm reporting an issue with perl-mode's font lock for perl keywords, and
suggesting a fix.
To reproduce:
- emacs -Q
- clear the scratch buffer
- M-x perl-mode
- enter the following text:
use Fake;
my $use = 123;
my $var = 123;
- observe the issue: `$use` is incorrectly highlighted - it should be
highlighted with the same color as `$var`, but it's highlighted with the
same color as `use` (on the first line).
The fix I suggest is borrowed from cperl-mode - extend the font lock regex
to *not* match keywords if they start with a perl sigil.
The diff is below, please let me know if it can be improved. I've signed
the copyright assignment.
From 8d1977cfc6c4884b231270c33c3bdabbd16b14aa Mon Sep 17 00:00:00 2001
From: Evgeni Kolev <evgenysw <at> gmail.com>
Date: Tue, 20 Feb 2018 18:14:29 +0200
Subject: [PATCH] lisp/progmodes/perl-mode.el: keyword regex must not match
sigils
---
lisp/progmodes/perl-mode.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index 9948078..c1d94ac 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -165,7 +165,7 @@ perl-font-lock-keywords-1
;; Fontify function and package names in declarations.
("\\<\\(package\\|sub\\)\\>[ \t]*\\(\\sw+\\)?"
(1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))
- ("\\<\\(import\\|no\\|require\\|use\\)\\>[ \t]*\\(\\sw+\\)?"
+ ("\\(^\\|[^$@%&\\]\\)\\<\\(import\\|no\\|require\\|use\\)\\>[
\t]*\\(\\sw+\\)?"
(1 font-lock-keyword-face) (2 font-lock-constant-face nil t)))
"Subdued level highlighting for Perl mode.")
--
2.9.0
[Message part 2 (text/html, inline)]
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Sat, 03 Mar 2018 11:10:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Evgeni Kolev <evgeni.d.kolev <at> gmail.com>
:
bug acknowledged by developer.
(Sat, 03 Mar 2018 11:10:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 30549-done <at> debbugs.gnu.org (full text, mbox):
> From: Evgeni Kolev <evgeni.d.kolev <at> gmail.com>
> Date: Tue, 20 Feb 2018 18:19:55 +0200
>
> I'm reporting an issue with perl-mode's font lock for perl keywords, and
> suggesting a fix.
>
> To reproduce:
>
> - emacs -Q
> - clear the scratch buffer
> - M-x perl-mode
> - enter the following text:
>
> use Fake;
> my $use = 123;
> my $var = 123;
>
> - observe the issue: `$use` is incorrectly highlighted - it should be
> highlighted with the same color as `$var`, but it's highlighted with the
> same color as `use` (on the first line).
>
> The fix I suggest is borrowed from cperl-mode - extend the font lock regex
> to *not* match keywords if they start with a perl sigil.
Thanks, pushed to the master branch.
In the future, please accompany your contributions with a Git log
message formatted like ChangeLog, see CONTRIBUTE for the details.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 31 Mar 2018 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 83 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.