March 26, 2008 3:12 PM
GnuEmacs is my main IDE and even though Flex Builder 3 has features1 to kill for, M-x compile has to work flawlessly for me. But the problem with Emacs's M-x compile is that it starts a process each time. This can slow down things when you're working with a really large flex project and mxmlc has to load on each compile. I'm impressed with the speed and awesomeness of the Flex Compiler Shell, so I've hacked M-x compile to re-use an existing instance of the Flex Compiler Shell on each recompile. Also, I got compilation-mode to recognize errors spit out by mxmlc and fcsh so that C-x ` takes you to the correct line of the file where the error / warning was found.

Installation is pretty simple, just grab ani-fcsh.el off the Code Archives page, customize some variables like the path to fcsh and output path to suit your environment and load ani-fcsh.el when emacs starts up by putting this in your .emacs:

(load "pathtofile/ani-fcsh.el")

To use ani-fcsh, run M-x fcsh-compile when you are visiting the buffer of the MXML file you want to compile. This will start off fcsh in the compilation buffer, run mxmlc buffername -o configuredoutputpath and display results. Next time when you run M-x recompile or M-x compile, it will clear the buffer and send compile 1 to the fcsh process in the compilation buffer without killing and starting a new fcsh instance.

To restore the normal operation of M-x compile, run M-x fcsh-restore-compile.

Use this along with actionscript-mode for smoother flex development on Emacs.

If you only want M-x compile to recognize errors and warnings while using mxmlc, then put the following snippet in your .emacs:

(require 'compile)
;; To let compile understad flex error / warning messages. This regexp
;; has been tested only on win.
(add-to-list 'compilation-error-regexp-alist 'flex)
(add-to-list 'compilation-error-regexp-alist-alist
	     '(flex "^\\(.*\\)(\\(.*\\)):.* \\(Error\\|Warnin\\(g\\)\\): .*$" 1 2 nil (4)))

CategoryEmacs Comment(s)


[1] Profiling and debugging rocks with Flex Builder 3!

Copyright © 2004-2011 Anirudh Sasikumar. All rights reserved.
Last Updated: March 26, 2008 3:54 PM