Emacs has a hide-ifdef-mode
.
In hide-ifdef-mode, code within #ifdef constructs that the C
preprocessor would eliminate may be hidden from view.
It can be activated via M-x hide-ifdef-mode
. For a basic usage, use the function hide-ifdefs
(default shortcut C-c @ h
).
`
#define MY_MACRO
#ifdef MY_MACRO
int foo = 0;//proper indent, normal color
#else...
#endif
To revert the effects, use the function show-ifdefs
(default shortcut C-c @ s
):
#define MY_MACRO
#ifdef MY_MACRO
int foo = 0;//proper indent, normal color
#else
int bar = 0;//proper indent, and gray color
#endif