Thursday, October 30, 2008

find the matching bracket in emacs

Parenthesis balancing in EMACS

An unbalanced parenthesis is one of the most common sources of a programmer's grief. So emacs has a couple of useful features for guarding against them.

You may have noticed that when you are writing C++ code with emacs and type a closing parenthesis, bracket, or brace, the cursor does a little hop to the matching opening character and then returns to its working position. If there is a problem finding the match, emacs flashes the message ``Mismatched parentheses'' in the minibuffer. If the match is so far back in the code that it isn't visible, emacs flashes the context of the matching parenthesis in the minibuffer.

Parenthesis checking can also be done with the mouse. Double left click on any parenthesis, brace, or bracket. Emacs then shows the matching symbol and highlights the code between them.

Source for this information was this.

No comments: