unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17116: perl mode vs. /./
@ 2014-03-27  8:25 積丹尼 Dan Jacobson
  2014-04-02 19:51 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: 積丹尼 Dan Jacobson @ 2014-03-27  8:25 UTC (permalink / raw)
  To: 17116

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#17116: perl mode vs. /./
  2014-03-27  8:25 bug#17116: perl mode vs. /./ 積丹尼 Dan Jacobson
@ 2014-04-02 19:51 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2014-04-02 19:51 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 17116-done

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






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-02 19:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27  8:25 bug#17116: perl mode vs. /./ 積丹尼 Dan Jacobson
2014-04-02 19:51 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).