GNU bug report logs - #11739
24.1; cperl font-lock (highlighting) bug with dollar+quote sequence ('...$')

Previous Next

Package: emacs;

Reported by: Vincent Lefevre <vincent <at> vinc17.net>

Date: Tue, 19 Jun 2012 10:28:02 UTC

Severity: normal

Found in version 24.1

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Vincent Lefevre <vincent <at> vinc17.net>
To: 11739 <at> debbugs.gnu.org
Subject: bug#11739: 24.1; font-lock (highlighting) bug with dollar+quote sequence ('...$')
Date: Tue, 19 Jun 2012 15:15:23 +0200
On 2012-06-19 12:23:51 +0200, Vincent Lefevre wrote:
> Open the following file with "emacs -Q <filename>":
> 
> ------------------------------------------------------------
> #!/usr/bin/env perl
> # -*- mode: cperl -*-
> 
> $foo = 'blah $ '
>   and print "$foo\n";  # OK
> 
> $foo = 'blah $'
>   and print "$foo\n";  # Incorrectly highlighted
> ------------------------------------------------------------
> 
> The first "and print ..." line is correctly highlighted, but not the
> second one. It seems that CPerl is confused by a $ at the end of a
> single-quote string literal.

The problem is due to this change in cperl-mode.el:

@@ -1832,7 +1832,13 @@
   (make-local-variable 'cperl-syntax-state)
   (setq cperl-syntax-state nil)                ; reset syntaxification cache
   (if cperl-use-syntax-table-text-property
-      (progn
+      (if (boundp 'syntax-propertize-function)
+          (progn
+            ;; Reset syntaxification cache.
+            (set (make-local-variable 'cperl-syntax-done-to) nil)
+            (set (make-local-variable 'syntax-propertize-function)
+                 (lambda (start end)
+                   (goto-char start) (cperl-fontify-syntaxically end))))
        (make-local-variable 'parse-sexp-lookup-properties)
        ;; Do not introduce variable if not needed, we check it!
        (set 'parse-sexp-lookup-properties t)

-- 
Vincent Lefèvre <vincent <at> vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




This bug report was last modified 13 years and 30 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.