Getting mmm-mode to work in emacs 24

emacs, ruby-on-rails

Solution

Unfortunately Emacs has no good canonical multi-mode editing story. sanityinc (Steve Purcell) has patched up MMM-mode for Emacs 24 here: https://github.com/purcell/mmm-mode

His config is here: https://github.com/purcell/emacs.d

as `init-ruby-mode.el` and `init-mmm.el`

but it's far from ideal (no indentation support, only highlight special regions.)

Other have had luck with nxhtml.

EDIT: add pointer to sanityinc's config

Problem

I have been trying to get mmm-mode to work, specifically for Rails development. I have followed the install instructions and I can't get to the specific mixed mode and special highlighting I was looking for. Most specifically erb files. Here is my .emacs file: ``` (custom-set-variables '(custom-enabled-themes (quote (zenburn))) '(custom-safe-themes (quote ("71b172ea4aad108801421cc5251edb6c792f3adbaecfa1c52e94e3d99634dee7" default))) '(show-paren-mode t)) (custom-set-faces ) ;; File associations. (setq auto-mode-alist (cons '("\\.builder$" . ruby-mode) auto-mode-alist)) (require 'mmm-auto) (setq mmm-submode-decoration-level 0) (mmm-add-group 'fancy-html '((html-erb :submode ruby-mode :match-face (("<%#" . mmm-comment-submode-face) ("<%=" . mmm-output-submode-face) ("<%" . mmm-code-submode-face)) :front "<%[#=]?" :back "%>" :insert ((?% erb-code nil @ "<%" @ " " _ " " @ "%>" @) (?# erb-comment nil @ "<%#" @ " " _ " " @ "%>" @) (?= erb-expression nil @ "<%=" @ " " _ " " @ "%>" @))))) (add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil fancy-html)) ``` Despite having a smooth install process following the instructions I have yet to be able to get highlighting to work in my erb files. I am running emacs 24 if that matters. So I followed the directions on in the download. I placed the folder afterwards in my .emacs.d folder. I have access to mmm-mode stuff in M-x. I just don't get highlighting for my modes and I can't find any reference to the declared modes. PS: Side note I can't get my zenburn theme to stick but that's a different mater. EDIT: The "instructions" I am referring to are at THIS link and the INSTALL file included with the targz in the download.

Original source