tags:

views:

159

answers:

1

Hello,

GNU emacs 23.1.1

I am using emacs to debug some code. However, the if and else blocks are very big and I cannot display the whole code on my terminal as I have to scroll down many screens. And there are so many of them as most of them are nested, if hard to know which ones below to which if else block.

if(something)
{
 /* very big code block with nested if/elses */
}
else
{
/* very big code block with nested if/elses */
}

I would like to put the cursor on the first curly brace and somehow go to where this code block ends.

Hope you understand,

Many thanks for any advice,

+5  A: 

C-M-f - forward-sexp

This will take you to the } that matches the { point is ion.

Nathaniel Flath
... and C-M-b will take you back. In this case cursor needs to be after the closing brace, whereas for C-M-f it needs to be "on" the opening brace. Also work for parenthesis and rectangle brackets "[]".
danielpoe
Funny, when I press the C-M it tabs a new space downwards.
robUK
Sorry, my mistake. I took the M as the 'm' key and not the 'Alt' key. Maybe need another ice coffee to keep me awake. Thanks.
robUK