bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21328: 25.0.50; css-mode: Indenting brackets in presence of pseudo-s


From: Simen Heggestøyl
Subject: bug#21328: 25.0.50; css-mode: Indenting brackets in presence of pseudo-selectors
Date: Sun, 23 Aug 2015 12:57:07 +0200

The current indentation rules in css-mode work well both for a style
where opening brackets are put at the the same line of selectors, like
so: "body { …", and when they are put on their own line, like in the
following example:

body
{
    background: white;

    main
    {
        background: green;
    }
}

However in the presence of a pseudo-class or pseudo-element, the
opening bracket that follows runs amok:

body
{
    background: white;

    main:first
             {
                 background: green;
             }
}

This should be fixed to accommodate both styles. It seems to me that
removing the `smie-rule-hanging-p' test from the following rule fixes
the problem:

(`(:before . "{")
 (when (smie-rule-hanging-p)
   (smie-backward-sexp ";")
   (smie-indent-virtual)))

However I haven't been able to fully understand how SMIE works yet, so
I'm not sure what that check was meant for in the first place, or
whether it breaks some other cases (though I haven't been able to find
such a case).

-- Simen


In GNU Emacs 25.0.50.15 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.6)
 of 2015-08-23 on x240
Repository revision: 7372c1ab067ba93054fbb042cd13211042b83614
Windowing system distributor `The X.Org Foundation', version 11.0.11702000
System Description: Debian GNU/Linux testing (stretch)

Configured features:
XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS NOTIFY LIBXML2 FREETYPE XFT
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: CSS

reply via email to

[Prev in Thread] Current Thread [Next in Thread]