From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: rustom Newsgroups: gmane.emacs.help Subject: Re: catching parenthesis errors in elisp Date: Fri, 12 Jun 2009 04:02:33 -0700 (PDT) Organization: http://groups.google.com Message-ID: <07451191-d899-482a-b9e4-99bfb176898a@a5g2000pre.googlegroups.com> References: <87vdn1rc01.fsf@lion.rapttech.com.au> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1244806871 6133 80.91.229.12 (12 Jun 2009 11:41:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Jun 2009 11:41:11 +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 13:41:08 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 1MF587-0003Yt-0x for geh-help-gnu-emacs@m.gmane.org; Fri, 12 Jun 2009 13:41:07 +0200 Original-Received: from localhost ([127.0.0.1]:50281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MF586-0004jo-8v for geh-help-gnu-emacs@m.gmane.org; Fri, 12 Jun 2009 07:41:06 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!postnews.google.com!a5g2000pre.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 51 Original-NNTP-Posting-Host: 220.225.70.2 Original-X-Trace: posting.google.com 1244804554 10873 127.0.0.1 (12 Jun 2009 11:02:34 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 12 Jun 2009 11:02:34 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: a5g2000pre.googlegroups.com; posting-host=220.225.70.2; posting-account=mBpa7woAAAAGLEWUUKpmbxm-Quu5D8ui User-Agent: G2/1.0 X-HTTP-Via: 1.1 PT-PROXY1, 1.1 PT-PROXY2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729), gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:169967 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor 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:65196 Archived-At: On Jun 12, 3:18=A0pm, Tim X wrote: > 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). Im only trying to make small changes to a 700 line func in org-mode. [I dont think I could write a 70 line lisp function if I tried :-) ] In making those changes Ive probably missed escaping (backslashing) a double-quote is what I guess. If I put the cursor on the start of the start (defun org-export-as-docbook and hit C-M-f I get unbalanced parenthesis 1, 27478 Putting it at the end of the defun and adding a close paren gives me mismatched parenthesis. Hence my diagnosis that its not a paren problem but a double-quote problem > > 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