From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: catching parenthesis errors in elisp Date: Fri, 12 Jun 2009 20:18:38 +1000 Organization: Rapt Technologies Message-ID: <87vdn1rc01.fsf@lion.rapttech.com.au> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1244803267 27934 80.91.229.12 (12 Jun 2009 10:41:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Jun 2009 10:41:07 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 12 12:41:05 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MF4Bz-0006eJ-Sj for geh-help-gnu-emacs@m.gmane.org; Fri, 12 Jun 2009 12:41:04 +0200 Original-Received: from localhost ([127.0.0.1]:40286 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MF4Bz-0007Lh-DN for geh-help-gnu-emacs@m.gmane.org; Fri, 12 Jun 2009 06:41:03 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!news.kjsl.com!news.alt.net!news.astraweb.com!border2.newsrouter.astraweb.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.94 (gnu/linux) Cancel-Lock: sha1:JUM903XgpXLkNl3fhI2rfF302gA= Original-Lines: 41 Original-NNTP-Posting-Host: b817575f.news.astraweb.com Original-X-Trace: DXC=7Bjemn]]X8fNIa8EGN3lWcL?0kYOcDh@j^ List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:65193 Archived-At: rustom writes: > Im hacking on a 700 line elisp function. > While doing some (fairly mechanical) cut-paste operations it looks > like either Ive got a parenthesis or a quote (most likely double quote > but could also be single quote) error. > > Any suggestions on how to catch such errors? Have a look at occur and make sure you are using paren matching mode. For lisp, I'd also suggest looking at paredit mode. It is a mode that is very handy for editing lisp like languages. It has commands for manipulating the text as sexps, puts in matching () etc. Takes a little to get use to it, but once you are, it makes editing lisp like languages really fast an efficient. Personally, I'd also be breaking up the function - 700 lines in one function is a little excessive IMO. Apart from making it harder to find simple syntax errors, it makes it harder to hold the whole thing in your head conceptually and probably has lots of repetition (your reference to cut and paste makes me suspect there is too much repetition. Try to follow the D.R.Y. mantra (Don't repeat yourself). My basic approach with lisp like languages is to write small functions, get them working in the repl and once I'm happy with them, put them into the source file. If I can't see the whole function in one screen, it usually means its time to break it down into smaller functions. If I can see lots of similar constructs in a function, then its almost certainly a sign its time to break the similar bits outinto its own function. HTH Tim -- tcross (at) rapttech dot com dot au