1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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.
This commit is contained in:
Simen Heggestøyl 2016-02-01 21:38:25 +01:00
parent ee8b466995
commit 1d07dcd720
3 changed files with 21 additions and 4 deletions

View file

@ -54,6 +54,14 @@
'("charset" "font-face" "import" "media" "namespace" "page")
"Identifiers that appear in the form @foo.")
(defconst css-bang-ids
'("important")
"Identifiers that appear in the form !foo.")
(defconst scss-bang-ids
'("default" "global" "optional")
"Additional identifiers that appear in the form !foo in SCSS.")
(defconst css-descriptor-ids
'("ascent" "baseline" "bbox" "cap-height" "centerline" "definition-src"
"descent" "font-family" "font-size" "font-stretch" "font-style"
@ -236,8 +244,8 @@
(defun css--font-lock-keywords (&optional sassy)
`((,(concat "!\\s-*"
(regexp-opt (append (if sassy '("global"))
'("important"))))
(regexp-opt (append (if sassy scss-bang-ids)
css-bang-ids)))
(0 font-lock-builtin-face))
;; Atrules keywords. IDs not in css-at-ids are valid (ignored).
;; In fact the regexp should probably be