From: Stefan Monnier Date: Thu, 9 Apr 2015 14:51:23 +0000 (-0400) Subject: css-mode.el (css-smie-rules): Fix indentation after complex selectors X-Git-Tag: emacs-25.0.90~2521 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6083965958381b29aa55948670d2b85289b0be6d;p=emacs.git css-mode.el (css-smie-rules): Fix indentation after complex selectors Fixes: debbugs:20282 * lisp/textmodes/css-mode.el (css-smie-rules): Don't get confused by inner structure of selectors. --- diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 72800808e65..851618cfccc 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -327,6 +327,10 @@ (`(: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))))) diff --git a/test/indent/css-mode.css b/test/indent/css-mode.css index 564ac16f954..faf91539d84 100644 --- a/test/indent/css-mode.css +++ b/test/indent/css-mode.css @@ -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;