Tag Archives: flex emacs

Multiple modes for mxml and Actionscript in Emacs

Flexing in Emacs again… Emacs 22 supports the entertainingly named MuMaMo mode which allows support for Multiple Major Modes. This is useful for editing MXML files that mix XML markup with Actionscript.

I am using MuMaMo together with actionscript-mode and nxml-mode with this definition in my .emacs:

(defun mumamo-chunk-mxml-script (pos min max)
"Find ... , return range and actionscript-mode."
(mumamo-quick-static-chunk pos min max "" "" nil 'actionscript-mode nil))

(define-mumamo-multi-major-mode mxml-actionscript-mumamo-mode
"Turn on multiple major modes for MXML files with main mode `nxml-mode'.
This covers inlined Actionscript."
("MXML Actionscript Family" nxml-mode

(add-to-list 'auto-mode-alist '("\\.mxml$" . mxml-actionscript-mumamo))