From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Newsgroups: gmane.emacs.bugs Subject: bug#21328: 25.0.50; css-mode: Indenting brackets in presence of pseudo-selectors Date: Sun, 23 Aug 2015 12:57:07 +0200 Message-ID: <1440327427.6295.0@smtp.gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=-R6SouiN9Yjl1W9C4SCt0" X-Trace: ger.gmane.org 1440327508 30254 80.91.229.3 (23 Aug 2015 10:58:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 23 Aug 2015 10:58:28 +0000 (UTC) To: 21328@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 23 12:58:17 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZTSye-0004r4-Dr for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Aug 2015 12:58:16 +0200 Original-Received: from localhost ([::1]:56867 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTSyd-000838-Id for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Aug 2015 06:58:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTSyT-0007xq-Uq for bug-gnu-emacs@gnu.org; Sun, 23 Aug 2015 06:58:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZTSyQ-0005Td-Me for bug-gnu-emacs@gnu.org; Sun, 23 Aug 2015 06:58:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43388) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTSyQ-0005TZ-Kf for bug-gnu-emacs@gnu.org; Sun, 23 Aug 2015 06:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZTSyQ-0002BS-99 for bug-gnu-emacs@gnu.org; Sun, 23 Aug 2015 06:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Aug 2015 10:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21328 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14403274408341 (code B ref -1); Sun, 23 Aug 2015 10:58:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Aug 2015 10:57:20 +0000 Original-Received: from localhost ([127.0.0.1]:35598 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZTSxj-0002AS-UD for submit@debbugs.gnu.org; Sun, 23 Aug 2015 06:57:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55186) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZTSxh-0002AK-Is for submit@debbugs.gnu.org; Sun, 23 Aug 2015 06:57:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZTSxg-00052o-8S for submit@debbugs.gnu.org; Sun, 23 Aug 2015 06:57:17 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:54833) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTSxg-00052k-5o for submit@debbugs.gnu.org; Sun, 23 Aug 2015 06:57:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTSxe-000735-TI for bug-gnu-emacs@gnu.org; Sun, 23 Aug 2015 06:57:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZTSxb-00052H-Lo for bug-gnu-emacs@gnu.org; Sun, 23 Aug 2015 06:57:14 -0400 Original-Received: from mail-la0-x22c.google.com ([2a00:1450:4010:c03::22c]:36626) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTSxb-00052B-89 for bug-gnu-emacs@gnu.org; Sun, 23 Aug 2015 06:57:11 -0400 Original-Received: by labjy4 with SMTP id jy4so12876970lab.3 for ; Sun, 23 Aug 2015 03:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:message-id:mime-version:content-type; bh=9pUaX+aUJKkMtZ/8ER2qlSyHJpJgZMK/eo+hQYRdhqc=; b=gvXZOfDlny6tcsb9j5chFZPQxVc2UH1XxikjPU/MywHqFiOoi7Qy0OX5AhqkPotHOd F2KojLl+YBRZu12DvfCDR/NOVdV+kh9zNuTHD4tEPHzRBcfrr0nOyIyua84iF0D1t/hM FzcE2b1D0BTZ+FvrEGwHrCK30lh/OF1pHcN13AdInX551eSqn3cUwdfitmpXa3qAVLlL AIJ0daxzptY5gRRW/zPQxtjNtWTtcEtjaOOlsZASaCVJ0KsH2PeyS8zqFuE0e/wUzFOS 0NIRC6S5IIugdi4neo6EAlvbgpdjp66s2ez5VYZ07M1DEBPVs75As1gKKScXzzId7hKE iHZQ== X-Received: by 10.112.147.201 with SMTP id tm9mr15504523lbb.40.1440327429934; Sun, 23 Aug 2015 03:57:09 -0700 (PDT) Original-Received: from [192.168.100.7] (cm-84.210.143.4.getinternet.no. [84.210.143.4]) by smtp.gmail.com with ESMTPSA id db9sm4095991lad.11.2015.08.23.03.57.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Aug 2015 03:57:09 -0700 (PDT) X-Mailer: geary/0.10.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:105720 Archived-At: --=-R6SouiN9Yjl1W9C4SCt0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable 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 { =E2=80=A6", and when they are put on their own line, like in th= e 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=20 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 = --=-R6SouiN9Yjl1W9C4SCt0 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
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 { =E2=80=A6", and when they are put on their own l= ine, like in the
following example:

body=
{
    background: white;

    main
    {
    =     background: green;
    }
}

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

=
body
{
    background: white;

    main:first
     = ;        {
         =        background: green;
    &nbs= p;        }
}

This s= hould be fixed to accommodate both styles. It seems to me that
re= moving 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)))

Ho= wever I haven't been able to fully understand how SMIE works yet, so
<= div>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
Reposi= tory revision: 7372c1ab067ba93054fbb042cd13211042b83614
Windowing= system distributor `The X.Org Foundation', version 11.0.11702000
System Description: Debian GNU/Linux testing (stretch)

Confi= gured 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
= --=-R6SouiN9Yjl1W9C4SCt0--