]> code.delx.au - gnu-emacs/commitdiff
Highlight two additional SCSS keywords
authorSimen Heggestøyl <simenheg@gmail.com>
Mon, 1 Feb 2016 20:38:25 +0000 (21:38 +0100)
committerSimen Heggestøyl <simenheg@gmail.com>
Mon, 1 Feb 2016 20:38:25 +0000 (21:38 +0100)
* 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.

lisp/textmodes/css-mode.el
test/indent/css-mode.css
test/indent/scss-mode.scss

index 96a82baa56cd8f2d12cf911b61d217ec2f2c47e9..b3a41d3822ca36b48ba9abc9f62df86b514cfe30 100644 (file)
   '("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"
 
 (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
index 24166b002827bb789a7144b70036350f6e058c70..3a00739bfc4bfc83d754c1a909acbb5b3acb514e 100644 (file)
@@ -9,7 +9,7 @@ article[role="main"] {
 }
 
 a, b:hover, c {
-    color: black;
+    color: black !important;
 }
 
 a, b:hover {                    /* bug:20282 */
index 02a4a98a8c57d6fbe72c2e9d943a229bae58dbdb..e1ec90a529985b6fd7ba5de04b529ac84cb448c8 100644 (file)
@@ -40,11 +40,20 @@ p.#{$name} var
 }
 article[role="main"] {
     $toto: 500 !global;
-    float: left;
+    $var-with-default: 300 !default;
+    float: left !important;
     width: 600px / 888px * 100%;
     height: 100px / 888px * 100%;
 }
 
+%placeholder {
+    color: #f0f0f0;
+}
+
+button {
+    @extend %placeholder !optional;
+}
+
 @import 'reset';
 
 @mixin border-radius($radius) {