all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Simen Heggestøyl" <simenheg@gmail.com>
To: 21328@debbugs.gnu.org
Subject: bug#21328: 25.0.50; css-mode: Indenting brackets in presence of pseudo-selectors
Date: Sun, 23 Aug 2015 12:57:07 +0200	[thread overview]
Message-ID: <1440327427.6295.0@smtp.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1603 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2492 bytes --]

             reply	other threads:[~2015-08-23 10:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-23 10:57 Simen Heggestøyl [this message]
2015-08-25 13:06 ` bug#21328: 25.0.50; css-mode: Indenting brackets in presence of pseudo-selectors Stefan Monnier
2015-08-26 20:55   ` Simen Heggestøyl
2015-08-28  1:36     ` Stefan Monnier
2015-08-28 18:14       ` Simen Heggestøyl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1440327427.6295.0@smtp.gmail.com \
    --to=simenheg@gmail.com \
    --cc=21328@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.