unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ergus <spacibba@aol.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: mardani29@yahoo.es, emacs-devel@gnu.org, acm@muc.de
Subject: Re: Issue with hide-ifdef and cc-mode
Date: Sun, 30 May 2021 21:27:39 +0200	[thread overview]
Message-ID: <20210530192739.34xj5ndlca4gpicm@Ergus> (raw)
In-Reply-To: <83pmx82gv8.fsf@gnu.org>

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	other threads:[~2021-05-30 19:27 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
2021-05-30 18:14     ` Ergus
2021-05-30 18:53       ` Eli Zaretskii
2021-05-30 19:27         ` Ergus [this message]
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=20210530192739.34xj5ndlca4gpicm@Ergus \
    --to=spacibba@aol.com \
    --cc=acm@muc.de \
    --cc=eliz@gnu.org \
    --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 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).