Subject: bug#17116: closed (Re: bug#17116: perl mode vs. /./)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 02 Apr 2014 19:52:02 +0000

Your bug report

#17116: perl mode vs. /./

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
17116: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17116
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#17116: perl mode vs. /./
From: Stefan Monnier <[email-masked]>
To: 積丹尼 Dan Jacobson <[email-masked]>
Cc: [email-masked]
Date: Wed, 02 Apr 2014 15:51:00 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

> $ 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.

Subject: perl mode vs. /./
From: 積丹尼 Dan Jacobson <[email-masked]>
To: [email-masked]
Date: Thu, 27 Mar 2014 16:25:26 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

$ cat o.pl
print for /./; #why is the rest of this line in this color?
$ emacs o.pl