Code between #if SYMBOL and #endif is greyed out in cc-mode if the SYMBOL has not been defined within the current file.

The project that I´m currently working on has a common code base for Mac and Windows so there´s a lot of #if WINDOWS and #if MAC in there. This results in lots of code in the editor that is grey and without syntax highlighting since these symbols are defined in some other compilation unit.

How can I enable syntax colouring in the current editor without editing the file? I can always add a #define SYMBOL 1 above the #if SYMBOL but this does not feel right?

  • 2
    I don't think cc-mode does this by default. Are you using hide-ifdef-mode by any chance? – rpluim Sep 14 at 9:18

It was emacs-cquery that shadowed code inside #if false regions. Setting cquery-enable-inactive-region to nil solved it.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.