Thanks for the thorough explanations.
On Tue, Aug 25, 2015 at 3:06 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
I'm familiar with the GNU style for indenting C and C++ code, however
I've never seen CSS or Sass code indented that way; it seems to me
that CSS code is always indented in one of the two styles I described
in the previous email.
In sum, I propose the following patch:
From cede79d7afe038290988070891367825f5b8c5d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= <simenheg@gmail.com>
Date: Sun, 23 Aug 2015 12:51:57 +0200
Subject: [PATCH] Fix indentation rule in css-mode
* lisp/textmodes/css-mode.el (css-smie-rules): Fix indentation of
brackets in presence of pseudo-selectors.
---
lisp/textmodes/css-mode.el | 2 +-
test/indent/css-mode.css | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index d73780c..639456d 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -344,7 +344,7 @@
(`(:elem . arg) 0)
(`(:list-intro . ,(or `";" `"")) t) ;"" stands for BOB (bug#15467).
(`(:before . "{")
- (when (smie-rule-hanging-p)
+ (when (or (smie-rule-hanging-p) (smie-rule-bolp))
(smie-backward-sexp ";")
(smie-indent-virtual)))
(`(:before . ,(or "{" "("))
diff --git a/test/indent/css-mode.css b/test/indent/css-mode.css
index 67a6b1e..2f04e96 100644
--- a/test/indent/css-mode.css
+++ b/test/indent/css-mode.css
@@ -36,3 +36,8 @@ 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 */
div.x3
{
}
+
+article:hover
+{
+ color: black;
+}
--
2.5.0