From: Ergus <spacibba@aol.com>
To: "Daniel Martín" <mardani29@yahoo.es>
Cc: emacs-devel@gnu.org, Alan Mackenzie <acm@muc.de>
Subject: Re: Issue with hide-ifdef and cc-mode
Date: Sun, 30 May 2021 20:14:11 +0200 [thread overview]
Message-ID: <20210530181411.jquh47dwgxtctmzc@Ergus> (raw)
In-Reply-To: <m14keklc33.fsf@yahoo.es>
On Sun, May 30, 2021 at 01:01:36PM +0200, Daniel Mart�n wrote:
>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.
>
Hi Daniel:
Thanks for the reply. It looks like I didn't understand the
documentation properly. (It is only a few lines)
I didn't know I need to manually call hide-ifdefs every time I change
the preprocessor argument. Because none of this is documented in the
manual. But also calling that makes the functionality pretty
sub-optimal.
It is bad that this functionality works fine out of the box either in
vim and in VS Code and other editors but not in emacs without user
explicit intervention.
So I am not sure how difficult may be to do it automatic without killing
the performance... Like font-lock does with everything else... Soes it
really kills performance to add his to font-lock?
I hope probably Alan may have an idea about how to solve this in a more
cc-mode way... Without forcing the user to interactively call
hide-ifdefs.
We do something similar with /* */ multi-line comments... I can't
understand why this may be so different for if 0 macros... But I may be
wrong.
next prev parent reply other threads:[~2021-05-30 18:14 UTC|newest]
Thread overview: 9+ 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
2021-05-30 18:14 ` Ergus [this message]
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
[not found] <20210527030630.ys6pbkbtqui66iuz.ref@Ergus>
2021-05-27 3:06 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210530181411.jquh47dwgxtctmzc@Ergus \
--to=spacibba@aol.com \
--cc=acm@muc.de \
--cc=emacs-devel@gnu.org \
--cc=mardani29@yahoo.es \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.