all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* hightlight if/ifdef blocks
@ 2006-10-31  8:24 Martin
  2006-10-31 12:37 ` Fang lun gang
  0 siblings, 1 reply; 7+ messages in thread
From: Martin @ 2006-10-31  8:24 UTC (permalink / raw)


Hi,

after reading some rules about not nesting c comments and using #if 0
instead I tried it out in emacs.
But as it is at the moment, the blocks are not shown as if I would have
commented them out.
Is there an easy way of doing this?
The blocks should look  the same way as the comments usually look when
I add a //.
so

// not_used_at_the_moment();

should have the same color as
#if 0
not_used_at_the_moment();
#endif

I tried different things where people suggested that I make these
blocks invisible.
But since that's not what I want ...
Any suggestions?

Thanks in advance

Martin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: hightlight if/ifdef blocks
  2006-10-31  8:24 hightlight if/ifdef blocks Martin
@ 2006-10-31 12:37 ` Fang lun gang
  2006-11-01  1:31   ` Michaël Cadilhac
       [not found]   ` <mailman.3.1162344693.2155.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Fang lun gang @ 2006-10-31 12:37 UTC (permalink / raw)


>>>>> "Martin" == Martin  <m.gercke@gmail.com> writes:

    Martin> Hi, after reading some rules about not nesting c comments and using
    Martin> #if 0 instead 
    Martin> // not_used_at_the_moment();

Would you please share the rules of why not nesting c comments?

I used to thought it is ok to nest comments marked using "//".

-- 
Fang lun gang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: hightlight if/ifdef blocks
  2006-10-31 12:37 ` Fang lun gang
@ 2006-11-01  1:31   ` Michaël Cadilhac
       [not found]   ` <mailman.3.1162344693.2155.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Michaël Cadilhac @ 2006-11-01  1:31 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 920 bytes --]

Fang lun gang <no@mail.com> writes:

>>>>>> "Martin" == Martin  <m.gercke@gmail.com> writes:
>
>     Martin> Hi, after reading some rules about not nesting c comments and using
>     Martin> #if 0 instead 
>     Martin> // not_used_at_the_moment();
>
> Would you please share the rules of why not nesting c comments?
>
> I used to thought it is ok to nest comments marked using "//".

// are not « native » C comment ;-)

I think Martin was talking about nesting /* */. The use of #if 0 is
quite a good practice.

-- 
/!\ My mail address changed, please update your files accordingly.
 |      Michaël `Micha' Cadilhac   |    Le copillage-collage                |
 |         Epita/LRDE Promo 2007   |       tue le programmeur.              |
 |  http://michael.cadilhac.name   |           -- Dictons LRDE              |
 `--  -   JID: micha@amessage.be --'                                   -  --'

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: hightlight if/ifdef blocks
       [not found]   ` <mailman.3.1162344693.2155.help-gnu-emacs@gnu.org>
@ 2006-11-01 15:05     ` Fang lun gang
  2006-11-02  8:22       ` Martin
  0 siblings, 1 reply; 7+ messages in thread
From: Fang lun gang @ 2006-11-01 15:05 UTC (permalink / raw)


>>>>> "Michaël" == Michaël Cadilhac <michael@cadilhac.name> writes:

    Michaël> I think Martin was talking about nesting /* */. The use of #if 0 is
    Michaël> quite a good practice.

Thank you.

So you mean if we can use '//', we'd prefer "#if 0" to "/* */".

-- 
Fang lun gang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: hightlight if/ifdef blocks
  2006-11-01 15:05     ` Fang lun gang
@ 2006-11-02  8:22       ` Martin
  2006-11-03 12:20         ` Fang lun gang
  0 siblings, 1 reply; 7+ messages in thread
From: Martin @ 2006-11-02  8:22 UTC (permalink / raw)


Hi,

originally I asked somebody about using // or /* */ in C.
1. old c-compilers do not allow the use of // because it was not part
of the "old" ANSI c standard.
2. new c-compilers mostly do, but some people still prefer to use /* */

My idea was to use // in "regular" comments and /* */ for commenting
out huge blocks of code.
I was then told that nesting of comments might or might not work with
the one or the other compiler.
To avoid this uncertainty I should use #if 0 which I think makes sense
and is ok for me. (can't find the post though, sorry ...)
However, emacs does not show me these blocks as "unused" comments, but
as c-code.
So, back to my original question ... how to get these blocks to change
their color :-)

Martin


Fang lun gang wrote:
> >>>>> "Michaël" == Michaël Cadilhac <michael@cadilhac.name> writes:
>
>     Michaël> I think Martin was talking about nesting /* */. The use of #if 0 is
>     Michaël> quite a good practice.
>
> Thank you.
>
> So you mean if we can use '//', we'd prefer "#if 0" to "/* */".
> 
> -- 
> Fang lun gang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: hightlight if/ifdef blocks
  2006-11-02  8:22       ` Martin
@ 2006-11-03 12:20         ` Fang lun gang
  2006-11-05 11:01           ` Martin
  0 siblings, 1 reply; 7+ messages in thread
From: Fang lun gang @ 2006-11-03 12:20 UTC (permalink / raw)


>>>>> "Martin" == Martin  <m.gercke@gmail.com> writes:

    Martin> might or might not work with the one or the other compiler.  To
    Martin> avoid this uncertainty I should use #if 0 which I think makes sense
    Martin> and is ok for me. (can't find the post though, sorry ...)  However,
    Martin> emacs does not show me these blocks as "unused" comments, but as
    Martin> c-code.  So, back to my original question ... how to get these
    Martin> blocks to change their color :-)

Thanks at first.

As to your original question, I known there is a hide-ifdef-mode although it
may not satisfy you. 

-- 
Fang lun gang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: hightlight if/ifdef blocks
  2006-11-03 12:20         ` Fang lun gang
@ 2006-11-05 11:01           ` Martin
  0 siblings, 0 replies; 7+ messages in thread
From: Martin @ 2006-11-05 11:01 UTC (permalink / raw)


As far as I understood the hide-ifdef-mode correctly it can either hide
code completely or partially.
As I just want to highlight the code this (in fact) doesn't help me.
Thanks anyway

Martin



Fang lun gang wrote:
> >>>>> "Martin" == Martin  <m.gercke@gmail.com> writes:
>
>     Martin> might or might not work with the one or the other compiler.  To
>     Martin> avoid this uncertainty I should use #if 0 which I think makes sense
>     Martin> and is ok for me. (can't find the post though, sorry ...)  However,
>     Martin> emacs does not show me these blocks as "unused" comments, but as
>     Martin> c-code.  So, back to my original question ... how to get these
>     Martin> blocks to change their color :-)
>
> Thanks at first.
>
> As to your original question, I known there is a hide-ifdef-mode although it
> may not satisfy you. 
> 
> -- 
> Fang lun gang

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-11-05 11:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-31  8:24 hightlight if/ifdef blocks Martin
2006-10-31 12:37 ` Fang lun gang
2006-11-01  1:31   ` Michaël Cadilhac
     [not found]   ` <mailman.3.1162344693.2155.help-gnu-emacs@gnu.org>
2006-11-01 15:05     ` Fang lun gang
2006-11-02  8:22       ` Martin
2006-11-03 12:20         ` Fang lun gang
2006-11-05 11:01           ` Martin

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.