Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find missing or mismatched braces / parens in emacs?

Tags:

emacs

When my code fails to compile and tells me that I am likely missing a closed brace, is there an easy way to find it in emacs?

like image 233
David LeBauer Avatar asked Nov 30 '10 23:11

David LeBauer


1 Answers

For languages like C, C++, and Java, the command check-parens will check parens (()), brackets ([]), and braces ({}):

M-x check-parens <RET> 

The point will move to a bracketing character that is unmatched, and the status line will report the problem.

It's a good idea to use this in conjunction with show-paren-mode as others have said.

like image 170
clstrfsck Avatar answered Sep 18 '22 18:09

clstrfsck