GNU bug report logs - #20282
css-mode: multiple selectors *sometimes* breaks indentation

Previous Next

Package: emacs;

Reported by: dse <at> webonastick.com

Date: Thu, 9 Apr 2015 06:28:02 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20282 in the body.
You can then email your comments to 20282 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#20282; Package emacs. (Thu, 09 Apr 2015 06:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to dse <at> webonastick.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 09 Apr 2015 06:28:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Darren Embry <dse <at> webonastick.com>
To: bug-gnu-emacs <at> gnu.org
Subject: css-mode: multiple selectors *sometimes* breaks indentation
Date: Wed, 8 Apr 2015 18:58:34 -0400
[Message part 1 (text/plain, inline)]
The following rather simple example of a chunk of CSS:

    a, b:hover {
           color: black;
       }

gets indented incorrectly.  The second line gets indented seven spaces
instead of four; the last gets three spaces instead of zero.

In this more complex example, the closing bracket lines up with the 'j':

    a.b:c,d.e:f,g[h]:i,j[k]:l,.m.n:o,.p.q:r,.s[t]:u,.v[w]:x {
  background-color: white;
                       }

This example, however, is indented just fine:

    a, b:hover, c {
        color: black;
    }

I've tried this in emacs-24.4 and emacs-24.5-rc3 on Linux, as well as 24.4
on the Windows platform.

Regards,
Darren
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20282; Package emacs. (Thu, 09 Apr 2015 14:53:01 GMT) Full text and rfc822 format available.

Message #8 received at 20282 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Darren Embry <dse <at> webonastick.com>
Cc: 20282 <at> debbugs.gnu.org
Subject: Re: bug#20282: css-mode: multiple selectors *sometimes* breaks
 indentation
Date: Thu, 09 Apr 2015 10:52:25 -0400
> The following rather simple example of a chunk of CSS:
>     a, b:hover {
>            color: black;
>        }
> gets indented incorrectly.

Indeed, thanks.  I installed the patch below which seems to fix
this problem.


        Stefan


diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 7280080..851618c 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -327,6 +327,10 @@
     (`(:elem . basic) css-indent-offset)
     (`(:elem . arg) 0)
     (`(:list-intro . ,(or `";" `"")) t) ;"" stands for BOB (bug#15467).
+    (`(:before . "{")
+     (when (smie-rule-hanging-p)
+       (smie-backward-sexp ";")
+       (smie-indent-virtual)))
     (`(:before . ,(or "{" "("))
      (if (smie-rule-hanging-p) (smie-rule-parent 0)))))
 




bug closed, send any further explanations to 20282 <at> debbugs.gnu.org and dse <at> webonastick.com Request was from Stefan Monnier <monnier <at> IRO.UMontreal.CA> to control <at> debbugs.gnu.org. (Thu, 09 Apr 2015 14:54:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 08 May 2015 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 48 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.