Flex development environment on Emacs

Note: All mode info and download link can be found in www.emacswiki.org.

  1. Install cc-mode

    Make a directory named cc-mode under your /site-lisp directory of emacs (e.g. /usr/share/emacs23/site-lisp).

    Download cc-mode compress package and uncompress it.

    Compile all the .el files according to its README document.

    Move all the .elc files to the /site-lisp/cc-mode directory.

  2. Install actionscript-mode

    Download actionscript-mode.el and move it to the /site-lisp directory of emacs

3.Modifiy your ~/.emacs file and add the following content, note the site-lisp dir path may be different on your machine:

(add-to-list 'load-path "/usr/share/emacs23/site-lisp/cc-mode")
(when (require 'actionscript-mode nil t)
 (setq auto-mode-alist
     (cons '("\.as" . actionscript-mode) auto-mode-alist)))

Open an .as file and you can see the syntax highlight now.

For .mxml file, it uses nxml-mode by default (I’m using emacs 23.1.1), you can switch to actionscript mode by typing M-x actionscript-mode RET to read AS code, and switch back by typing M-x nxml-mode RET to read xml code. Currently there is no flex-mode.el available and I don’t like the multi-major-mode idea.