1

In cc-mode, I want a way set all syntax highlight colours to slightly more desaturated versions when inside a #if 0 ... #endif block. If that would be troublesome/hard to maintain (having to set all the colours manually), just setting all the text inside the block to a single colour would be fine too. I've tried this, but is intended for use with a single keyword.

I'm using spacemacs 0.300.0@26.3

Dan
  • 32,584
  • 6
  • 98
  • 168
Luctins
  • 120
  • 7

1 Answers1

1

Emacs has a built-in package for ifdefs. To quote from https://www.gnu.org/software/emacs/manual/html_node/emacs/Other-C-Commands.html:

 ‘M-x hide-ifdef-mode’
      Hide-ifdef minor mode hides selected code within ‘#if’ and ‘#ifdef’
      preprocessor blocks.  If you change the variable
      ‘hide-ifdef-shadow’ to ‘t’, Hide-ifdef minor mode shadows
      preprocessor blocks by displaying them with a less prominent face,
      instead of hiding them entirely.  See the documentation string of
      ‘hide-ifdef-mode’ for more information.
wasamasa
  • 21,803
  • 1
  • 65
  • 97