0

I'm using Emacs 24, and although I'm not a very experienced Emacs Lisper, I've gotten things to work reasonably well. That said, I have no idea how to go about getting the standard css-mode to use cc-mode's indentation. I like the way cc-mode knows how to indent after an opening brace and unindent when it encounters a closing brace on a new line.

edit: I'm one of those horrible people who uses Allman-style braces, so I'll show you what I have so far. When I press , my cursor ends up at the box character:

@media print                                                                    
{
    #table-of-contents                                                          
    {
        display: none
    }
□

but I want it to be like this:

@media print                                                                    
{
    #table-of-contents                                                          
    {
        display: none
    }
    □
Ryan M
  • 647
  • 2
  • 6
  • 16

1 Answers1

0

CC mode is probably overkill for CSS, but see this example for deriving from it for a new language:

http://cc-mode.sourceforge.net/derived-mode-ex.el

One thing that might come up is the unindenting of labels or class visibility specifiers (things followed by ':', since that is common in CSS) in CC mode. Worth a shot, though!

neal
  • 557
  • 2
  • 9
  • 1
    Although, I have to mention that I get the indentation you asked for in the default css-mode in Emacs 24.3. So I'm not sure what exactly is lacking in the built-in css-mode. – neal Jul 15 '14 at 18:00
  • Some Googling prior to asking this question suggested that I should be getting that behavior as default, but it doesn't seem to be the case. I'll edit my original post to reflect what's going on more explicitly. – Ryan M Jul 15 '14 at 20:15