aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorSimen Heggestøyl2016-02-01 21:38:25 +0100
committerSimen Heggestøyl2016-02-01 21:38:25 +0100
commit1d07dcd720890764774770e0ad24ba11a5bda233 (patch)
tree4a72b7ed09878ea11b9a012044c60c6d6fe0a4f9 /lisp
parentee8b46699523cc1dea7b3d03e3cccff3d62cd847 (diff)
downloademacs-1d07dcd720890764774770e0ad24ba11a5bda233.tar.gz
emacs-1d07dcd720890764774770e0ad24ba11a5bda233.zip
Highlight two additional SCSS keywords
* lisp/textmodes/css-mode.el (css-bang-ids): New defconst holding CSS identifiers on the form !foo. (scss-bang-ids): New defconst holding SCSS identifiers on the form !foo. (css--font-lock-keywords): Highlight the new SCSS bang identifiers in `font-lock-builtin-face'. * test/indent/css-mode.css: Add bang rule test case. * test/indent/scss-mode.css: Add test cases for the introduced bang rules.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/textmodes/css-mode.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 96a82baa56c..b3a41d3822c 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -54,6 +54,14 @@
54 '("charset" "font-face" "import" "media" "namespace" "page") 54 '("charset" "font-face" "import" "media" "namespace" "page")
55 "Identifiers that appear in the form @foo.") 55 "Identifiers that appear in the form @foo.")
56 56
57(defconst css-bang-ids
58 '("important")
59 "Identifiers that appear in the form !foo.")
60
61(defconst scss-bang-ids
62 '("default" "global" "optional")
63 "Additional identifiers that appear in the form !foo in SCSS.")
64
57(defconst css-descriptor-ids 65(defconst css-descriptor-ids
58 '("ascent" "baseline" "bbox" "cap-height" "centerline" "definition-src" 66 '("ascent" "baseline" "bbox" "cap-height" "centerline" "definition-src"
59 "descent" "font-family" "font-size" "font-stretch" "font-style" 67 "descent" "font-family" "font-size" "font-stretch" "font-style"
@@ -236,8 +244,8 @@
236 244
237(defun css--font-lock-keywords (&optional sassy) 245(defun css--font-lock-keywords (&optional sassy)
238 `((,(concat "!\\s-*" 246 `((,(concat "!\\s-*"
239 (regexp-opt (append (if sassy '("global")) 247 (regexp-opt (append (if sassy scss-bang-ids)
240 '("important")))) 248 css-bang-ids)))
241 (0 font-lock-builtin-face)) 249 (0 font-lock-builtin-face))
242 ;; Atrules keywords. IDs not in css-at-ids are valid (ignored). 250 ;; Atrules keywords. IDs not in css-at-ids are valid (ignored).
243 ;; In fact the regexp should probably be 251 ;; In fact the regexp should probably be