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: Ergus
Subject: Re: Issue with hide-ifdef and cc-mode
Date: Sun, 30 May 2021 21:27:39 +0200

Hi Eli:

On Sun, May 30, 2021 at 09:53:15PM +0300, Eli Zaretskii wrote:
Date: Sun, 30 May 2021 20:14:11 +0200
From: Ergus <spacibba@aol.com>
Cc: emacs-devel@gnu.org, Alan Mackenzie <acm@muc.de>

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.

Please be sure to read the commentary at the beginning of hideif.el,
it explains quite a lot.

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.

??? How can Emacs know which preprocessor symbols are defined and
which undefined?  You have "C-c @ d" and "C-c @ u" to tell Emacs which
symbols are defined and which undefined.

This part is fine for me. In my use case using 0 or 1 should be defined
as numeric values right? so I don't need to define anything. For more
complex cases I understand these commands are very useful; but not in
this simple case.

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'm not sure I understand: what do you need to automate?  Once you
turn on hiding, the display automatically changes as you define and
undefine preprocessor symbols.

I mean:

#if 0
<CODE>
#endif

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

does not shadows the region.

I need to explicitly call M-x hide-ifdefs

But also

If I change after that #if 0 -> #if 1; the shadow does not disappears
inmediately. So I need to call: M-x hide-ifdefs again.

This is the part that I think may be automatized. Calling hide-ifdefs
every time is annoying.

Emacs is smart enough to recognize when the user modifies a
cpp-macro. And multi-line code highlight is simple like /* */ does...
What I am missing here?



reply via email to

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