GNU bug report logs -
#17174
24.3; perl-mode highlight: unrecognized perl var $' starts a string
Previous Next
Reported by: "G.raud" <graud <at> gmx.com>
Date: Wed, 2 Apr 2014 15:46:02 UTC
Severity: minor
Found in version 24.3
Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Bug is archived. No further changes may be made.
Full log
Message #10 received at 17174-done <at> debbugs.gnu.org (full text, mbox):
> $ 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
This bug report was last modified 11 years and 57 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.