changeset 78571:fd7a34f481ad

(perl-font-lock-syntactic-keywords): Correctly match / regexp matchers as first char on a line when fontifying only that line.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 16 Aug 2007 14:20:37 +0000
parents 328998bce865
children 5b92bb6e6570
files lisp/ChangeLog lisp/progmodes/perl-mode.el
diffstat 2 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Aug 16 04:24:57 2007 +0000
+++ b/lisp/ChangeLog	Thu Aug 16 14:20:37 2007 +0000
@@ -1,5 +1,9 @@
 2007-08-16  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* progmodes/perl-mode.el (perl-font-lock-syntactic-keywords):
+	Correctly match / regexp matchers as first char on a line when
+	fontifying only that line.
+
 	* emacs-lisp/cl-macs.el (cl-transform-lambda): Preserve the match-data.
 
 2007-08-16  Glenn Morris  <rgm@gnu.org>
--- a/lisp/progmodes/perl-mode.el	Thu Aug 16 04:24:57 2007 +0000
+++ b/lisp/progmodes/perl-mode.el	Thu Aug 16 14:20:37 2007 +0000
@@ -267,8 +267,16 @@
     ("^[ \t]*format.*=[ \t]*\\(\n\\)" (1 '(7)))
     ;; Funny things in sub arg specifications like `sub myfunc ($$)'
     ("\\<sub\\s-+\\S-+\\s-*(\\([^)]+\\))" 1 '(1))
-    ;; regexp and funny quotes
-    ("[?:.,;=!~({[][ \t\n]*\\(/\\)" (1 '(7)))
+    ;; Regexp and funny quotes.
+    ("\\(?:[?:.,;=!~({[]\\|\\(^\\)\\)[ \t\n]*\\(/\\)"
+     (2 (if (and (match-end 1)
+                 (save-excursion
+                   (goto-char (match-end 1))
+                   (skip-chars-backward " \t\n")
+                   (not (memq (char-before)
+                              '(?? ?: ?. ?, ?\; ?= ?! ?~ ?\( ?\[)))))
+            nil ;; A division sign instead of a regexp-match.
+          '(7))))
     ("\\(^\\|[?:.,;=!~({[ \t]\\)\\([msy]\\|q[qxrw]?\\|tr\\)\\>\\s-*\\([^])}> \n\t]\\)"
      ;; Nasty cases:
      ;; /foo/m  $a->m  $#m $m @m %m