aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimen Heggestøyl2017-06-11 17:41:09 +0200
committerSimen Heggestøyl2017-06-11 19:32:17 +0200
commitee051688c18b3bd7bb7c7a01100f09f7dd402ba6 (patch)
tree57811395709db4c3951a5c59bfbc1cf23c929a30
parent8160c7d914882b40badf9eb8e4792da1b313745e (diff)
downloademacs-ee051688c18b3bd7bb7c7a01100f09f7dd402ba6.tar.gz
emacs-ee051688c18b3bd7bb7c7a01100f09f7dd402ba6.zip
Fix highlighting of CSS selectors with double hyphens
* lisp/textmodes/css-mode.el (css--font-lock-keywords): Fix highlighting of selectors that contain double hyphens. They would be mistaken for a variable.
-rw-r--r--lisp/textmodes/css-mode.el4
-rw-r--r--test/manual/indent/css-mode.css5
2 files changed, 7 insertions, 2 deletions
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 45d750af755..0beaaaa32f1 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -852,8 +852,6 @@ cannot be completed sensibly: `custom-ident',
852 ;; Since "An at-rule consists of everything up to and including the next 852 ;; Since "An at-rule consists of everything up to and including the next
853 ;; semicolon (;) or the next block, whichever comes first." 853 ;; semicolon (;) or the next block, whichever comes first."
854 (,(concat "@" css-ident-re) (0 font-lock-builtin-face)) 854 (,(concat "@" css-ident-re) (0 font-lock-builtin-face))
855 ;; Variables.
856 (,(concat "--" css-ident-re) (0 font-lock-variable-name-face))
857 ;; Selectors. 855 ;; Selectors.
858 ;; Allow plain ":root" as a selector. 856 ;; Allow plain ":root" as a selector.
859 ("^[ \t]*\\(:root\\)\\(?:[\n \t]*\\)*{" (1 'css-selector keep)) 857 ("^[ \t]*\\(:root\\)\\(?:[\n \t]*\\)*{" (1 'css-selector keep))
@@ -898,6 +896,8 @@ cannot be completed sensibly: `custom-ident',
898 'font-lock-multiline t) 896 'font-lock-multiline t)
899 ;; No face. 897 ;; No face.
900 nil))) 898 nil)))
899 ;; Variables.
900 (,(concat "--" css-ident-re) (0 font-lock-variable-name-face))
901 ;; Properties. Again, we don't limit ourselves to css-property-ids. 901 ;; Properties. Again, we don't limit ourselves to css-property-ids.
902 (,(concat "\\(?:[{;]\\|^\\)[ \t]*\\(" 902 (,(concat "\\(?:[{;]\\|^\\)[ \t]*\\("
903 "\\(?:\\(" css-proprietary-nmstart-re "\\)\\|" 903 "\\(?:\\(" css-proprietary-nmstart-re "\\)\\|"
diff --git a/test/manual/indent/css-mode.css b/test/manual/indent/css-mode.css
index 79b082188f5..bf612b53a14 100644
--- a/test/manual/indent/css-mode.css
+++ b/test/manual/indent/css-mode.css
@@ -77,3 +77,8 @@ div::before {
77 url("Sans-Regular.eot") format("eot"), 77 url("Sans-Regular.eot") format("eot"),
78 url("Sans-Regular.woff") format("woff"); 78 url("Sans-Regular.woff") format("woff");
79} 79}
80
81.foo-bar--baz {
82 --foo-variable: 5px;
83 margin: var(--foo-variable);
84}