Getting Emacs's flymake-mode to work with SCons was surprisingly easy. It needs some extra elisp in your .emacs to invoke flymake, which can be lightly adapted from the existing makefile processing, and a small check in the SConstruct to see if the process has been invoked by flymake itself. In my case, I arrange for a command line flag SYNTAX=1 to be passed from Flymake to SCons. For example..
The Emacs side involves some lightly edited versions of flymake functions in the .emacs as the scons command line is as make-like as it's sanely possible to be; a design goal of the SCons guys
The main drawback of this method is that it does not check header files directly, as SCons does not process them as they produce no direct build products. This leads me to suspect that SCons is not really the correct tool for this job; although a env.SyntaxCheck command could probably be rigged up: another post for another day.
EDIT: After some more work on this, I got header files working. The snag is that I've had to customise flymake-master-file-dirs to be relative to the directory in which include files are found include in my case. Which is probably not ideal - they should be relative to the buildfile.
The official emacs wiki gives this, simpler, method: http://www.emacswiki.org/emacs/FlyMake#toc5
I have not tried out either of the approaches yet, so I don't know how well it works compared to your more ambitious method.
The emacs wiki one is probably the way to go. It's just that the dumpvars target is not documented in the Flymake docs and I wasn't aware of the need for it. Even then to get this to work my flymake project dirs had to be relative to my include dir so that Flymake could find sources with the right include in, in order to check. It was this undocumented method that trips me over and that the Emacs Wiki doesn't mention. Probably I should do a quick edit..
Post a Comment