Subject: bug#15467: CSS-mode gives weird indentation when you put opening bracket on its own line

From: Paul Pogonyshev <[email-masked]>
Date: Mon, 7 Oct 2013 09:14:05 +0200

This fixes the problem I originally reported, but there seem to be more:

.x1
{
}

.x2
 {
 }

div.x3
   {
   }

As you see only the first rule is indented properly.

As a feature request, it would be nice if '}' triggered auto-indent on
insertion, as in e.g. various programming modes.

Paul

On 4 October 2013 23:46, Stefan Monnier <[email-masked]> wrote:

> > For example, if you create a CSS buffer and put
> > .xxx
> > {
> > }
> > into it, indentation adds one space before '{'. Confusingly, if you add
> one
>
> Indeed, thanks.  Should be fixed now in the trunk thanks to the
> patch below.
>
>
>         Stefan
>
>
> --- lisp/textmodes/css-mode.el  2013-08-29 21:00:18 +0000
> +++ lisp/textmodes/css-mode.el  2013-10-04 21:40:55 +0000
> @@ -302,6 +302,7 @@
>    (pcase (cons kind token)
>      (`(:elem . basic) css-indent-offset)
>      (`(:elem . arg) 0)
> +    (`(:list-intro . "") t)             ;"" stands for BOB (bug#15467).
>      (`(:before . "{") (if (smie-rule-hanging-p)
>                           (smie-rule-parent 0)))))
>
>
>