all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Cc: 17116-done@debbugs.gnu.org
Subject: bug#17116: perl mode vs. /./
Date: Wed, 02 Apr 2014 15:51:00 -0400	[thread overview]
Message-ID: <jwv8uruwfzk.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <87k3bgyrnt.fsf@jidanni.org> ("積丹尼 Dan Jacobson"'s message of "Thu, 27 Mar 2014 16:25:26 +0800")

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






      reply	other threads:[~2014-04-02 19:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27  8:25 bug#17116: perl mode vs. /./ 積丹尼 Dan Jacobson
2014-04-02 19:51 ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv8uruwfzk.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=17116-done@debbugs.gnu.org \
    --cc=jidanni@jidanni.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.