3

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?

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

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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