bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17174: 24.3; perl-mode highlight: unrecognized perl var $' starts a


From: Stefan Monnier
Subject: bug#17174: 24.3; perl-mode highlight: unrecognized perl var $' starts a string
Date: Wed, 02 Apr 2014 20:42:46 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

> $ 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 via email to

[Prev in Thread] Current Thread [Next in Thread]