* bug#20282: css-mode: multiple selectors *sometimes* breaks indentation
@ 2015-04-08 22:58 Darren Embry
2015-04-09 14:52 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Darren Embry @ 2015-04-08 22:58 UTC (permalink / raw)
To: 20282
[-- Attachment #1: Type: text/plain, Size: 643 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 1559 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#20282: css-mode: multiple selectors *sometimes* breaks indentation
2015-04-08 22:58 bug#20282: css-mode: multiple selectors *sometimes* breaks indentation Darren Embry
@ 2015-04-09 14:52 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2015-04-09 14:52 UTC (permalink / raw)
To: Darren Embry; +Cc: 20282
> 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)))))
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-09 14:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-08 22:58 bug#20282: css-mode: multiple selectors *sometimes* breaks indentation Darren Embry
2015-04-09 14:52 ` Stefan Monnier
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.