Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So I have this huge file (a SharePoint rendering templates file, if you're interested). The problem is, it doesn't work, because somewhere inside that file, in a code block, there is an unmatched '('. How do I find it? I'm on a Windows machine, but I have all the GNU command-line utilities installed.

share|improve this question
4  
Obligatory XKCD. –  slhck Mar 21 '12 at 18:30
    
You can always go through it by hand. ;) I have an effective mental algorithm that I use for this kind of debugging. I should code up a Perl script to automate it though, at some point. :) –  Ben Richards Mar 21 '12 at 19:03
    
@sidran32, you just keep a count, and see where it goes negative? –  soandos Mar 21 '12 at 19:11
    
@soandos More or less. Or where it stays positive. :) It also helps that compilers will start throwing errors directly after the line where the error is. Before I realized how to do that kind of debugging properly, it really was a nightmare to try and fix. :P One mismatched curly brace, missing semicolon, or mismatched parenthesis can trigger hundreds of errors. –  Ben Richards Mar 21 '12 at 19:15
1  
To be honest, with proper indentation, it is almost never hard to fix. If you don't have that, it can be a nightmare. –  soandos Mar 21 '12 at 19:21

1 Answer 1

up vote 1 down vote accepted

Use the emacs command M-x check-parens<RET>.

Turning on show-paren-mode would also probably be a good idea.

share|improve this answer
    
I'm more of a Vim person, but looks like this is my only option. Thanks! –  Mihai Mar 21 '12 at 20:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.