--- Begin Message ---
Subject: |
Re: bug#17116: perl mode vs. /./ |
Date: |
Wed, 02 Apr 2014 15:51:00 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> $ cat o.pl
> print for /./; #why is the rest of this line in this color?
> $ emacs o.pl
Thanks for the clear test case.
Because perl-mode doesn't understand this code. It considers the first
slash as a "plain slash" (e.g. the one used for division), whereas the
second, being right after a punctuation (and hence can's be a division),
is assumed to start a regexp.
I installed the patch below which should fix those problems.
Stefan
=== modified file 'lisp/progmodes/perl-mode.el'
--- lisp/progmodes/perl-mode.el 2014-04-02 19:47:50 +0000
+++ lisp/progmodes/perl-mode.el 2014-04-02 19:48:21 +0000
@@ -276,7 +276,7 @@
;; perl-font-lock-special-syntactic-constructs.
((concat "\\(?:\\(?:^\\|[^$@&%[:word:]]\\)"
(regexp-opt '("split" "if" "unless" "until" "while" "split"
- "grep" "map" "not" "or" "and"))
+ "grep" "map" "not" "or" "and" "for" "foreach"))
"\\|[?:.,;=!~({[]\\|\\(^\\)\\)[ \t\n]*\\(/\\)")
(2 (ignore
(if (and (match-end 1) ; / at BOL.
--- End Message ---