Some refactoring + compilation database support

Hi Xavier,

I wish you a happy new year !

1. patch #cd2e02e is simple refactoring goodness
2. patch #5a8dd20 adds the support for compilation databases to clang_complete.
3. patch #80e554e introduces the usage of 'context manager' to handle cleanly directory changes in the presence of exceptions. This is not absolutely required, as this is already handled with patch 2, but it makes the code way cleaner and safer to refactor. The only drawback is it requires python >= 2.6. Python 2.5 can be supported by adding some requires, but I am not sure about the python requirements for clang_complete, so we may want to tweak it.

Patches 1 & 2 have been reviewed and used by tobig

Cheers