]> code.delx.au - gnu-emacs/commitdiff
css-mode.el (css-smie-rules): Fix indentation after complex selectors
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 9 Apr 2015 14:51:23 +0000 (10:51 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 9 Apr 2015 14:51:23 +0000 (10:51 -0400)
Fixes: debbugs:20282
* lisp/textmodes/css-mode.el (css-smie-rules): Don't get confused by
inner structure of selectors.

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

index 72800808e6581ca13f73c1bef5edd2b606552e0e..851618cfccc9f24bb52f4ef3c0bd039142747629 100644 (file)
     (`(:elem . basic) css-indent-offset)
     (`(:elem . arg) 0)
     (`(:list-intro . ,(or `";" `"")) t) ;"" stands for BOB (bug#15467).
+    (`(:before . "{")
+     (when (smie-rule-hanging-p)
+       (smie-backward-sexp ";")
+       (smie-indent-virtual)))
     (`(:before . ,(or "{" "("))
      (if (smie-rule-hanging-p) (smie-rule-parent 0)))))
 
index 564ac16f954ef22a1ca8acf911b6842e2c6276dc..faf91539d8436fa4255ee4aebddef07200f66024 100644 (file)
@@ -8,6 +8,21 @@ article[role="main"] {
     width: 60%;
 }
 
+a, b:hover, c {
+    color: black;
+}
+
+a, b:hover {                    /* bug:20282 */
+    c {
+        color: black;
+    }
+    color: black;
+}
+
+a.b:c,d.e:f,g[h]:i,j[k]:l,.m.n:o,.p.q:r,.s[t]:u,.v[w]:x { /* bug:20282 */
+    background-color: white;
+}
+
 /* asdfasdf */
 @foo x2 {
     bla:toto;