Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

code between '#ifndef' with a different fore/background color

12 views
Skip to first unread message

Rodrigo Canellas

unread,
Jul 23, 2008, 12:08:38 PM7/23/08
to Help-gn...@gnu.org
Hi,

Is is possible to define that a block of code between a '#ifdef XYZ' -
'#endif', when 'XYZ' is not defined, is displayed with a different
foreground (or background) font color?

thanks a lot!

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

weber

unread,
Jul 23, 2008, 5:13:14 PM7/23/08
to
On Jul 23, 1:08 pm, Rodrigo Canellas <rodrigo.canel...@tqtvd.com>
wrote:

I don't think that's be possible, because you can even define a
"DEFINE" by command line to gcc, right?
Just changing background for the region between #ifdef to #endif can
be done, though.
-weber
-weber

Lennart Borgman (gmail)

unread,
Jul 23, 2008, 5:46:46 PM7/23/08
to Rodrigo Canellas, Help-gn...@gnu.org
Rodrigo Canellas wrote:
> Hi,
>
> Is is possible to define that a block of code between a '#ifdef XYZ' -
> '#endif', when 'XYZ' is not defined, is displayed with a different
> foreground (or background) font color?

I do not think you can do it directly, but if you know emacs lisp you
could hack hide-ifdef-mode to do it.

If you do that then please tell us how you did it.


Jason Rumney

unread,
Jul 23, 2008, 8:34:08 PM7/23/08
to
On Jul 23, 10:46 pm, "Lennart Borgman (gmail)"

See hide-ifdef-shadow (the variable to enable it, and the face of the
same name to customize the fore/background).

Tim X

unread,
Jul 24, 2008, 8:38:58 AM7/24/08
to
Rodrigo Canellas <rodrigo....@tqtvd.com> writes:

> Hi,
>
> Is is possible to define that a block of code between a '#ifdef XYZ' -
> '#endif', when 'XYZ' is not defined, is displayed with a different
> foreground (or background) font color?
>

An ability similar to this apparently exists in emacs 23
(CVS). Accoridng to the news file, you can make these constructs
"shaded" rather than just invisible. I'm assuming shading really eans
setting them to different foreground/background colours to the main/rest
of the text.

Tim


--
tcross (at) rapttech dot com dot au

0 new messages