diff options
| author | Stefan Monnier | 2015-04-09 10:51:23 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2015-04-09 10:51:23 -0400 |
| commit | 6083965958381b29aa55948670d2b85289b0be6d (patch) | |
| tree | b4093ee60f44f2000db9e62a559675e4d0e8e7bc | |
| parent | c9415ccbf84fce152e0f4b98ac2ed60680272a47 (diff) | |
| download | emacs-6083965958381b29aa55948670d2b85289b0be6d.tar.gz emacs-6083965958381b29aa55948670d2b85289b0be6d.zip | |
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.
| -rw-r--r-- | lisp/textmodes/css-mode.el | 4 | ||||
| -rw-r--r-- | test/indent/css-mode.css | 15 |
2 files changed, 19 insertions, 0 deletions
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 @@ | |||
| 327 | (`(:elem . basic) css-indent-offset) | 327 | (`(:elem . basic) css-indent-offset) |
| 328 | (`(:elem . arg) 0) | 328 | (`(:elem . arg) 0) |
| 329 | (`(:list-intro . ,(or `";" `"")) t) ;"" stands for BOB (bug#15467). | 329 | (`(:list-intro . ,(or `";" `"")) t) ;"" stands for BOB (bug#15467). |
| 330 | (`(:before . "{") | ||
| 331 | (when (smie-rule-hanging-p) | ||
| 332 | (smie-backward-sexp ";") | ||
| 333 | (smie-indent-virtual))) | ||
| 330 | (`(:before . ,(or "{" "(")) | 334 | (`(:before . ,(or "{" "(")) |
| 331 | (if (smie-rule-hanging-p) (smie-rule-parent 0))))) | 335 | (if (smie-rule-hanging-p) (smie-rule-parent 0))))) |
| 332 | 336 | ||
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"] { | |||
| 8 | width: 60%; | 8 | width: 60%; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | a, b:hover, c { | ||
| 12 | color: black; | ||
| 13 | } | ||
| 14 | |||
| 15 | a, b:hover { /* bug:20282 */ | ||
| 16 | c { | ||
| 17 | color: black; | ||
| 18 | } | ||
| 19 | color: black; | ||
| 20 | } | ||
| 21 | |||
| 22 | 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 */ | ||
| 23 | background-color: white; | ||
| 24 | } | ||
| 25 | |||
| 11 | /* asdfasdf */ | 26 | /* asdfasdf */ |
| 12 | @foo x2 { | 27 | @foo x2 { |
| 13 | bla:toto; | 28 | bla:toto; |