]> git.eshelyaron.com Git - emacs.git/commitdiff
css-mode: Don't confuse variable names with class names
authorWilfred Hughes <me@wilfred.me.uk>
Fri, 20 Oct 2017 14:04:37 +0000 (15:04 +0100)
committerWilfred Hughes <me@wilfred.me.uk>
Fri, 20 Oct 2017 14:04:37 +0000 (15:04 +0100)
This fixes highlighting for class names that contain --, for example:

.foo--bar {
    display: none;
}

* lisp/textmodes/css-mode.el (css--font-lock-keywords): Make regular
  expression stricter.

lisp/textmodes/css-mode.el

index 9022ab7c3fbe9ec3b38f83926b0042890c17c5b2..0a4cb998b5703b4d48887531054dd7ed30ae864e 100644 (file)
@@ -896,7 +896,7 @@ cannot be completed sensibly: `custom-ident',
                      ;; No face.
                      nil)))
     ;; Variables.
-    (,(concat "--" css-ident-re) (0 font-lock-variable-name-face))
+    (,(concat (rx symbol-start) "--" css-ident-re) (0 font-lock-variable-name-face))
     ;; Properties.  Again, we don't limit ourselves to css-property-ids.
     (,(concat "\\(?:[{;]\\|^\\)[ \t]*\\("
               "\\(?:\\(" css-proprietary-nmstart-re "\\)\\|"