emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue with hide-ifdef and cc-mode


From: Daniel Martín
Subject: Re: Issue with hide-ifdef and cc-mode
Date: Sun, 30 May 2021 13:01:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin)

Ergus <spacibba@aol.com> writes:

>
> I am trying to use hide-ifdef to shadow code like:
>
> #if 0
> <code>
> #endif
>
> But I found that either
>
> #if 0
>
> or 
> #if 1
>
> produces the same result disabling the code inside.
>

I tested the following from emacs -Q in Emacs 28:

New C buffer with

#if 0
int i = 0;
#endif

M-x hide-ifdef-mode
M-x hide-ifdef-toggle-shadowing
M-x hide-ifdefs

And the variable definition is shown with a comment font-lock face, as
expected.

If I change it to "#if 1" and M-x hide-ifdefs again, the comment
font-lock face is removed, as expected.  Perhaps some Emacs
customization is getting in the way?

For something more complex than a #if 0, you probably need to ask the C
preprocessor or build system for the defined variables and configure
hide-ifdef-mode accordingly.

>
> Also when I remove the #if macros from around the code the shadow face
> sometimes persist.
>

This could be a bug.  If you have some consistent steps to reproduce it,
you could report it via M-x report-emacs-bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]