help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Surrounding statements with conditionals in C mode.


From: Stefan Monnier
Subject: Re: Surrounding statements with conditionals in C mode.
Date: Mon, 08 Sep 2003 14:34:11 GMT
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

> Eg. The following code :

>       printf("This is debugging info: %d\n",i);
>       printf("This is some more debugging info: \n");

> should become

> #ifdef MACRO_NAME
>       printf("This is debugging info: %d\n",i);
>       printf("This is some more debugging info: \n");
> #endif

(define-skeleton my-c-conditionalize
  "Conditionalize a piece of code with cpp stuff."
  "CPP var to use: "
  \n "#ifdef " str
  \n _
  \n "#endif /* " str " */" \n)

And then (using transient-mark-mode) select the region of code you want
to conditionalize and do M-x my-c-conditionalize RET MACRO_NAME RET


        Stefan



reply via email to

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