unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20107: [PATCH 1/3] css-mode: Discriminate between pseudo-classes and -elements
@ 2015-03-14 11:19 Simen Heggestøyl
  2015-03-14 11:21 ` bug#20107: [PATCH 2/3] css-mode: Add support for completion in `css-mode' Simen Heggestøyl
  2015-03-14 11:22 ` bug#20107: [PATCH 3/3] css-mode: Update CSS property list Simen Heggestøyl
  0 siblings, 2 replies; 6+ messages in thread
From: Simen Heggestøyl @ 2015-03-14 11:19 UTC (permalink / raw)
  To: 20107

[-- Attachment #1: Type: text/plain, Size: 3150 bytes --]

Hi.

The following patch makes `css-mode' discriminate between
pseudo-classes and pseudo-ids. While it might not seem immediately
useful to do so, it will become useful when completion at point is
implemented in a later patch.


 From b87dadfbbacbd1372ba31e2f591a260e7b4b581f Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= <simenheg@gmail.com>
Date: Sat, 14 Mar 2015 10:54:39 +0100
Subject: [PATCH 1/3] 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.
---
 lisp/ChangeLog             |  8 ++++++++
 lisp/textmodes/css-mode.el | 21 ++++++++++++++++-----
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d393190..70122c7 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2015-03-14  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-13  Kevin Ryde  <user42_kevin@yahoo.com.au>

 	info-look fixes for Texinfo 5
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 44dc4df..dc11d44 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -120,10 +120,17 @@
 ;;    (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")
@@ -258,7 +265,11 @@
          (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]*"
-- 
2.1.4

[-- Attachment #2: Type: text/html, Size: 4845 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-18 17:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-14 11:19 bug#20107: [PATCH 1/3] css-mode: Discriminate between pseudo-classes and -elements Simen Heggestøyl
2015-03-14 11:21 ` bug#20107: [PATCH 2/3] css-mode: Add support for completion in `css-mode' Simen Heggestøyl
2015-03-14 11:22 ` bug#20107: [PATCH 3/3] css-mode: Update CSS property list Simen Heggestøyl
2015-03-14 14:05   ` Stefan Monnier
2015-03-15 12:46     ` Simen Heggestøyl
2015-03-18 17:41   ` Simen Heggestøyl

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).