]> git.eshelyaron.com Git - emacs.git/commitdiff
Discriminate between pseudo-classes and -elements
authorSimen Heggestøyl <simenheg@gmail.com>
Tue, 17 Mar 2015 21:33:36 +0000 (22:33 +0100)
committerSimen Heggestøyl <simenheg@gmail.com>
Tue, 17 Mar 2015 21:50:10 +0000 (22:50 +0100)
* 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.

lisp/ChangeLog
lisp/textmodes/css-mode.el

index 57d988b6887f380bc31e4f90e10a9451e1b82d35..898d9cbf36171c1f7b13d395e172ff7ddaf2a833 100644 (file)
@@ -1,3 +1,11 @@
+2015-03-17  Simen Heggestøyl  <simenheg@gmail.com>
+
+       * 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.
+
 2015-03-17  Bozhidar Batsov  <bozhidar@batsov.com>
 
        * progmodes/ruby-mode.el (ruby-font-lock-keywords): Font-lock
index 44dc4dff3de2f81c79d4d4588338c52e603d69c3..c88960373cbf188f053f72b99ae835153f497a49 100644 (file)
@@ -3,6 +3,7 @@
 ;; Copyright (C) 2006-2015 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
+;; Maintainer: Simen Heggestøyl <simenheg@gmail.com>
 ;; Keywords: hypermedia
 
 ;; This file is part of GNU Emacs.
 ;;    (media . "^ +\\* '\\([^ '\n]+\\)' media group")
 ;;    (property . "^ +\\* '\\([^ '\n]+\\)',")))
 
-(defconst css-pseudo-ids
-  '("active" "after" "before" "first" "first-child" "first-letter" "first-line"
-    "focus" "hover" "lang" "left" "link" "right" "visited")
-  "Identifiers for pseudo-elements and pseudo-classes.")
+(defconst css-pseudo-class-ids
+  '("active" "checked" "disabled" "empty" "enabled" "first"
+    "first-child" "first-of-type" "focus" "hover" "indeterminate" "lang"
+    "last-child" "last-of-type" "left" "link" "nth-child"
+    "nth-last-child" "nth-last-of-type" "nth-of-type" "only-child"
+    "only-of-type" "right" "root" "target" "visited")
+  "Identifiers for pseudo-classes.")
+
+(defconst css-pseudo-element-ids
+  '("after" "before" "first-letter" "first-line")
+  "Identifiers for pseudo-elements.")
 
 (defconst css-at-ids
   '("charset" "font-face" "import" "media" "page")
          (concat "\\(?:" scss--hash-re
                  "\\|[^@/:{} \t\n#]\\)"
                  "[^:{}#]*\\(?:" scss--hash-re "[^:{}#]*\\)*"))
-       "\\(?::" (regexp-opt css-pseudo-ids t)
+       ;; Even though pseudo-elements should be prefixed by ::, a
+       ;; single colon is accepted for backward compatibility.
+       "\\(?:\\(:" (regexp-opt (append css-pseudo-class-ids
+                                       css-pseudo-element-ids) t)
+       "\\|\\::" (regexp-opt css-pseudo-element-ids t) "\\)"
        "\\(?:([^\)]+)\\)?"
        (if (not sassy)
            "[^:{}\n]*"