unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Daniel Martín" <mardani29@yahoo.es>
To: Ergus <spacibba@aol.com>
Cc: emacs-devel@gnu.org
Subject: Re: Issue with hide-ifdef and cc-mode
Date: Sun, 30 May 2021 13:01:36 +0200	[thread overview]
Message-ID: <m14keklc33.fsf@yahoo.es> (raw)
In-Reply-To: <20210530070822.h57mmtpp2n7dvpbf@Ergus> (Ergus's message of "Sun,  30 May 2021 09:08:22 +0200")

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	other threads:[~2021-05-30 11:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210530070822.h57mmtpp2n7dvpbf.ref@Ergus>
2021-05-30  7:08 ` Issue with hide-ifdef and cc-mode Ergus
2021-05-30 11:01   ` Daniel Martín [this message]
2021-05-30 18:14     ` Ergus
2021-05-30 18:53       ` Eli Zaretskii
2021-05-30 19:27         ` Ergus
2021-05-31 11:56           ` Eli Zaretskii
2021-05-30 19:42       ` Stefan Monnier
2021-05-30 20:26         ` Ergus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m14keklc33.fsf@yahoo.es \
    --to=mardani29@yahoo.es \
    --cc=emacs-devel@gnu.org \
    --cc=spacibba@aol.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).