]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix highlighting of CSS selectors with double hyphens
authorSimen Heggestøyl <simenheg@gmail.com>
Sun, 11 Jun 2017 15:41:09 +0000 (17:41 +0200)
committerSimen Heggestøyl <simenheg@gmail.com>
Sun, 11 Jun 2017 17:32:17 +0000 (19:32 +0200)
* lisp/textmodes/css-mode.el (css--font-lock-keywords): Fix
highlighting of selectors that contain double hyphens.  They would be
mistaken for a variable.

lisp/textmodes/css-mode.el
test/manual/indent/css-mode.css

index 45d750af755cd1347ccc874b50d14deb534ea8f7..0beaaaa32f1778f0fa20c28aacc73f322fb55d5e 100644 (file)
@@ -852,8 +852,6 @@ cannot be completed sensibly: `custom-ident',
     ;; Since "An at-rule consists of everything up to and including the next
     ;; semicolon (;) or the next block, whichever comes first."
     (,(concat "@" css-ident-re) (0 font-lock-builtin-face))
-    ;; Variables.
-    (,(concat "--" css-ident-re) (0 font-lock-variable-name-face))
     ;; Selectors.
     ;; Allow plain ":root" as a selector.
     ("^[ \t]*\\(:root\\)\\(?:[\n \t]*\\)*{" (1 'css-selector keep))
@@ -898,6 +896,8 @@ cannot be completed sensibly: `custom-ident',
                                         'font-lock-multiline t)
                      ;; No face.
                      nil)))
+    ;; Variables.
+    (,(concat "--" 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 "\\)\\|"
index 79b082188f510ca123188530cfbaae8757b4b2bc..bf612b53a14b01323d99f2aa012cc973f9b9bf19 100644 (file)
@@ -77,3 +77,8 @@ div::before {
         url("Sans-Regular.eot") format("eot"),
         url("Sans-Regular.woff") format("woff");
 }
+
+.foo-bar--baz {
+    --foo-variable: 5px;
+    margin: var(--foo-variable);
+}