all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: pjb@informatimago.com (Pascal J. Bourguignon)
To: help-gnu-emacs@gnu.org
Subject: Re: [OT] Re: What is the best way to navigate #ifdef and #endif in C program
Date: Wed, 04 Aug 2010 12:27:14 +0200	[thread overview]
Message-ID: <87y6cmsmf1.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: c28b51a6-38c7-4009-be60-0a8c1b014705@f42g2000yqn.googlegroups.com

Fren Zeee <frenzeee@gmail.com> writes:

> On Aug 2, 5:31 pm, "Daniel (Youngwhan)" <breadn...@gmail.com> wrote:
>> Hi,
>>
>> If there is curly brace, it is easy to navigate between them by M-C-f
>> and M-C-b in c-mode.
>>
>> However, I cannot find a way to navigate in like curly brace when it
>> comes to #ifdef, #else, and #endif.
>>
>> For example, if there is a code like this:
>>
>> #ifdef A_DEFINED
>> (...100 lines)
>> #else
>> (... 500 lines)
>> #endif
>>
>> , is there a easy way to move the cursor from #endif to #ifdef or
>> #else and vice versa?
>>
>> Daniel
>
> You might get better luck posting in a C group also.
>
> I use #ifdef ... #endif often also to comment out blocks of code
> during debugging.
>
> My question to CLISP/ELISP/scheme people is

clisp is an implementation, not a language. 

There is a language named Common Lisp, abreviated as CL.  Perhaps you
mean that?



> If there is a wrapper do nothing type function in elisp/clisp/scheme
> which can have the same effect as commenting out.
>
> This is because I dont like to do comment-region/uncomment-region in
> emacs.
>
> These three lispy languages dont seem to have comment block construct
> like C ie /* and */

AFAIK, emacs lisp doesn't have any block comment feature, and I know
no standard way to do block comment in r5rs scheme, but scheme
implementation may provide the same as in Common Lisp, or with a
different syntax.

In Common Lisp you could try to use #| |#, but unfortunately, it is not like C /* and */:

int a[]={
/* hello
   /* world
*/
1,2};
// a contains {1,2}.


(let ((a '(
#| hello
   #|  world 
|#
          1 2)))
  a)

is a syntactic error.


You would have to write:

(let ((a '(
#| hello
   #|  world  |#
|#
         1 2)))
  a)
--> (1 2)



However, in Common Lisp, you could implement a reader macro with a
behavior similar to C /* comments */.

This is the reason why there is no point asking whether there is a
feature X in CL.  You can always add any feature to the language,
thanks to its macros or reader macros, and metalinguistic abilities in
general.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


  reply	other threads:[~2010-08-04 10:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-03  0:31 What is the best way to navigate #ifdef and #endif in C program Daniel (Youngwhan)
2010-08-04  4:45 ` [OT] " Fren Zeee
2010-08-04 10:27   ` Pascal J. Bourguignon [this message]
2010-08-04 10:38     ` Alessio Stalla
2010-08-04 11:57       ` Pascal J. Bourguignon
2010-08-04 14:37     ` Elena
2010-08-04 14:59       ` Arzobispo Andante
2010-08-04 15:09       ` Peter Keller
2010-08-04 15:35         ` Peter Keller
2010-08-05 19:04         ` Elena
2010-08-05 21:10           ` Peter Keller
2010-08-05 23:46             ` Pascal J. Bourguignon
     [not found]           ` <8c27aoFij2U1@mid.individual.net>
2010-08-06 11:17             ` Elena
2010-08-06 13:55               ` Pascal J. Bourguignon
2010-08-04 16:20   ` Elena
2010-08-04 16:23   ` Elena
2010-08-05 18:00   ` Emmy Noether
2010-08-06  4:59   ` [OT] " Aaron W. Hsu
2010-08-05 17:30 ` Johan Bockgård
2010-08-06 17:03 ` Alan Mackenzie

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=87y6cmsmf1.fsf@kuiper.lan.informatimago.com \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.