_ Note: this post is a web cache recover of a November 2010 post that got lost with the blog crash. I updated it to add C/C++ autocompletion. _
One of the nice features of fat IDEs is that you get real time syntax checking. Some languages make it easy, some not.
For example Eclipse has access to the compiler as a service inside the IDE, and it checks the code as you type, even suggesting fixes.
I started to research what could be done on the emacs side to get a better experience, as when I am coding, I am usually thinking at the same time I write, and this means I make more syntax errors than the average guy.
Going forward with python was easy. A flymake extension that uses pyflakes (a python checking program) was already available.
It was with C/C++ where things started to get more complicated. Flymake has support for those hardcoded so that make with a special target is invoked. I wanted to check the current file only. Also gcc syntax errors are not that good.
I was so happy to have this working on C++ that I needed more to challenge my new acquired mastery. So I decided to try it with ycp. Not that I code with it that often, but I have colleagues who do. After adapting the extensions, here is the result:
You can find all the required files on my emacs setup repository. Follow custom.el which goes to custom-$lang.el to site-lisp/flymake-$lang.el.
Thanks to this post I managed to get also Rails .erb templates working. Those are more tricky as they can’t be parsed directly by ruby, but they have to go first through erb -x and then through ruby -c. I ported the script to the style of loading (init and load functions) I was already using.
Thanks to this autocomplete extension, I was able to setup autocompletion using clang for C/C++. Here is how it looks like:
Next! ruby autocompletion.