Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

According to EmacsWiki there are bunch of CSS modes for Emacs, but none of them seems to be very actively developed or even that feature complete. Which one is the most feature complete so far and is being maybe even maintained?

Features

  • Syntax highlighting
  • Well behaved indentation
  • Commenting
    • Region
    • Line
  • Validation
    • Error reporting

Problems with the default CSS mode

One of the reason why the current CSS mode doesn't cut it for me is because it indents selectors NOT like this

div.bar input,
div.bar select {
    float: left;
}

, but like this

div.bar input,
        div.bar select {
                float: left;
        }

which is simply unbearable.

share|improve this question

2 Answers 2

I'm using the css-mode that comes with GNU Emacs 24 and it indents fine (the way you want). It does all what you want except validation, and it's part of GNU Emacs so it's maintained. I haven't tried it, but I think css-tidy.el can do validation.

The only customizations I have are

(setq cssm-indent-function #'cssm-c-style-indenter)
(setq cssm-indent-level 2)

but I think those are remnants of some former css mode since neither is defined anywhere. What Emacs are you using and what command is being used to indent (C-h k TAB)?

share|improve this answer
1  
I'm using the Emacs 23.3. (9.0) on Mac OS X which I installed with homebrew. It might be that I ought to update the CSS mode from the upstream. Someone else told me about those customizations as well, but they don't seem to work. –  Bleadof Jan 31 '12 at 12:18
    
It looks like neither css-indent-function nor css-indent-calculate has changed since 2007 when the file was initially imported. It seems like something must be messed up. What is the value of indent-line-function? –  Ivan Andrus Jan 31 '12 at 18:10

if you are doing inline where you have both html and css code look into nxhtml mode, its one mode that will have the proper syntax editing and highlighting for both css and html.

share|improve this answer
    
Sadly that's not what I'm looking for... –  Bleadof Mar 6 '12 at 15:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.