MMM-mode config

written by zsombor on June 2nd, 2005 @ 12:30 PM

For those wondering about MMM-mode setup I'm publishing here relevant part of my .emacs. If only I would have kept former one more organized, I could have share it now in its entirety, instead of just pieces. What you need to see here is erb delimeters, rest is just decoration anyway.

(require 'mmm-mode)
(setq mmm-global-mode 'maybe)
(setq mmm-submode-decoration-level 2)
(mmm-add-classes
 '((embedded-ruby
    :submode ruby-mode
    :front "<%[=#]?"
    :back "%>"
    :insert ((?r eruby-directive nil @ "<%" @ " " _ " " @ "%>" @)
             (?= eruby-directive nil @ "<%=" @ " " _ " " @ "%>" @)))))
(mmm-add-classes
 '((embedded-css
    :submode css-mode
    :face mmm-declaration-submode-face
    :front "style=\""
    :back "\"")))
(mmm-add-classes
 '((embedded-javascript
    :submode javascript-mode ;; javascript-generic-mode
    :face mmm-declaration-submode-face
    :front "<script\[^>\]*>"
    :back "</script>")))
(mmm-add-classes
 '((embedded-javascript-attribute
    :submode javascript-mode ;; javascript-generic-mode
    :face mmm-declaration-submode-face
    :front "\\bon\\w+=\\s-*\""
    :back "\"")))

;; What files to invoke the new html-mode for?
(add-to-list 'auto-mode-alist '("\\.rhtml$" . html-mode))
;; What features should be turned on in this html-mode?
(add-to-list 'mmm-mode-ext-classes-alist
         '(html-mode nil embedded-css))
(add-to-list 'mmm-mode-ext-classes-alist
         '(html-mode nil embedded-ruby))
(add-to-list 'mmm-mode-ext-classes-alist
         '(html-mode nil embedded-javascript))
(add-to-list 'mmm-mode-ext-classes-alist
         '(html-mode nil embedded-javascript-attribute))

Hope it helps.

Post a comment

Options:

Size

Colors