Indent macros as regular C code in emacs

Indenting macros as it were regular code, may cause confusion, since macros are not to be considered part of the code. Although, when programming with openmp and its directives (#pragma omp), it’s annoying to have they indented to the beginning of the line, specially because openmp directives may be nested.

So, to change indentation, add the following line to you .emacs configuration file:

(c-set-offset (quote cpp-macro) 0 nil)

Source: http://stackoverflow.com/questions/4669219/indent-preprocessor-directives-as-c-code-in-emacs

Leave a comment