all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: "G.raud" <graud@gmx.com>
Cc: 17174-done@debbugs.gnu.org
Subject: bug#17174: 24.3; perl-mode highlight: unrecognized perl var $' starts a string
Date: Wed, 02 Apr 2014 20:42:46 -0400	[thread overview]
Message-ID: <jwv1txfw8gj.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <20140402121353.GA29773@gmx.com> (G. raud's message of "Wed, 2 Apr 2014 14:14:11 +0200")

> $ cat <<"EOF" >test.pl
> #!/usr/bin/perl
> $_ = 'truc'; /ru/;
> print "$'\n"; # this is highlighted as expected
> print $'; # this starts a string that continues to the next line
> print "\n";
> EOF
> $ emacs24 -Q test.pl

Thanks for the clear test case.  I installed the patch below in
emacs-24, which should fix it.


        Stefan


--- lisp/progmodes/perl-mode.el	2014-04-02 19:50:05 +0000
+++ lisp/progmodes/perl-mode.el	2014-04-03 00:37:11 +0000
@@ -250,7 +250,11 @@
       ;; Catch ${ so that ${var} doesn't screw up indentation.
       ;; This also catches $' to handle 'foo$', although it should really
       ;; check that it occurs inside a '..' string.
-      ("\\(\\$\\)[{']" (1 ". p"))
+      ("\\(\\$\\)[{']" (1 (unless (and (eq ?\' (char-after (match-end 1)))
+                                       (save-excursion
+                                         (not (nth 3 (syntax-ppss
+                                                      (match-beginning 0))))))
+                            (string-to-syntax ". p"))))
       ;; Handle funny names like $DB'stop.
       ("\\$ ?{?^?[_[:alpha:]][_[:alnum:]]*\\('\\)[_[:alpha:]]" (1 "_"))
       ;; format statements






      reply	other threads:[~2014-04-03  0:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-02 12:14 bug#17174: 24.3; perl-mode highlight: unrecognized perl var $' starts a string G.raud
2014-04-03  0:42 ` 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=jwv1txfw8gj.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=17174-done@debbugs.gnu.org \
    --cc=graud@gmx.com \
    /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.