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.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Darren Embry <dse <at> webonastick.com>
Cc: 20282 <at> debbugs.gnu.org
Subject: 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)))))
 




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.