aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimen Heggestøyl2015-03-17 22:33:36 +0100
committerSimen Heggestøyl2015-03-17 22:50:10 +0100
commit64db0c26faba21e7aedc0c5f57e04ed175b04f5b (patch)
treec04f3d730e8187e322e8f8d19b4c34802d6e9a69
parent5b77d81840b2dff821abefb2adb1f7f2f495be62 (diff)
downloademacs-64db0c26faba21e7aedc0c5f57e04ed175b04f5b.tar.gz
emacs-64db0c26faba21e7aedc0c5f57e04ed175b04f5b.zip
Discriminate between pseudo-classes and -elements
* textmodes/css-mode.el (css--font-lock-keywords): Discriminate between pseudo-classes and pseudo-elements. (css-pseudo-ids): Remove. (css-pseudo-class-ids): New variable. (css-pseudo-element-ids): New variable.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/textmodes/css-mode.el22
2 files changed, 25 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 57d988b6887..898d9cbf361 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12015-03-17 Simen Heggestøyl <simenheg@gmail.com>
2
3 * textmodes/css-mode.el (css--font-lock-keywords): Discriminate
4 between pseudo-classes and pseudo-elements.
5 (css-pseudo-ids): Remove.
6 (css-pseudo-class-ids): New variable.
7 (css-pseudo-element-ids): New variable.
8
12015-03-17 Bozhidar Batsov <bozhidar@batsov.com> 92015-03-17 Bozhidar Batsov <bozhidar@batsov.com>
2 10
3 * progmodes/ruby-mode.el (ruby-font-lock-keywords): Font-lock 11 * progmodes/ruby-mode.el (ruby-font-lock-keywords): Font-lock
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 44dc4dff3de..c88960373cb 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -3,6 +3,7 @@
3;; Copyright (C) 2006-2015 Free Software Foundation, Inc. 3;; Copyright (C) 2006-2015 Free Software Foundation, Inc.
4 4
5;; Author: Stefan Monnier <monnier@iro.umontreal.ca> 5;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
6;; Maintainer: Simen Heggestøyl <simenheg@gmail.com>
6;; Keywords: hypermedia 7;; Keywords: hypermedia
7 8
8;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
@@ -120,10 +121,17 @@
120;; (media . "^ +\\* '\\([^ '\n]+\\)' media group") 121;; (media . "^ +\\* '\\([^ '\n]+\\)' media group")
121;; (property . "^ +\\* '\\([^ '\n]+\\)',"))) 122;; (property . "^ +\\* '\\([^ '\n]+\\)',")))
122 123
123(defconst css-pseudo-ids 124(defconst css-pseudo-class-ids
124 '("active" "after" "before" "first" "first-child" "first-letter" "first-line" 125 '("active" "checked" "disabled" "empty" "enabled" "first"
125 "focus" "hover" "lang" "left" "link" "right" "visited") 126 "first-child" "first-of-type" "focus" "hover" "indeterminate" "lang"
126 "Identifiers for pseudo-elements and pseudo-classes.") 127 "last-child" "last-of-type" "left" "link" "nth-child"
128 "nth-last-child" "nth-last-of-type" "nth-of-type" "only-child"
129 "only-of-type" "right" "root" "target" "visited")
130 "Identifiers for pseudo-classes.")
131
132(defconst css-pseudo-element-ids
133 '("after" "before" "first-letter" "first-line")
134 "Identifiers for pseudo-elements.")
127 135
128(defconst css-at-ids 136(defconst css-at-ids
129 '("charset" "font-face" "import" "media" "page") 137 '("charset" "font-face" "import" "media" "page")
@@ -258,7 +266,11 @@
258 (concat "\\(?:" scss--hash-re 266 (concat "\\(?:" scss--hash-re
259 "\\|[^@/:{} \t\n#]\\)" 267 "\\|[^@/:{} \t\n#]\\)"
260 "[^:{}#]*\\(?:" scss--hash-re "[^:{}#]*\\)*")) 268 "[^:{}#]*\\(?:" scss--hash-re "[^:{}#]*\\)*"))
261 "\\(?::" (regexp-opt css-pseudo-ids t) 269 ;; Even though pseudo-elements should be prefixed by ::, a
270 ;; single colon is accepted for backward compatibility.
271 "\\(?:\\(:" (regexp-opt (append css-pseudo-class-ids
272 css-pseudo-element-ids) t)
273 "\\|\\::" (regexp-opt css-pseudo-element-ids t) "\\)"
262 "\\(?:([^\)]+)\\)?" 274 "\\(?:([^\)]+)\\)?"
263 (if (not sassy) 275 (if (not sassy)
264 "[^:{}\n]*" 276 "[^:{}\n]*"