all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: rustom <rustompmody@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: catching parenthesis errors in elisp
Date: Fri, 12 Jun 2009 04:02:33 -0700 (PDT)	[thread overview]
Message-ID: <07451191-d899-482a-b9e4-99bfb176898a@a5g2000pre.googlegroups.com> (raw)
In-Reply-To: 87vdn1rc01.fsf@lion.rapttech.com.au

On Jun 12, 3:18 pm, Tim X <t...@nospam.dev.null> wrote:
> rustom <rustompm...@gmail.com> 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



  reply	other threads:[~2009-06-12 11:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-12  7:05 catching parenthesis errors in elisp rustom
2009-06-12  9:57 ` Thien-Thi Nguyen
2009-06-12 10:18 ` Tim X
2009-06-12 11:02   ` rustom [this message]
2009-06-12 10:26 ` Thierry Volpiatto
2009-06-12 11:55 ` Xah Lee
2009-06-12 12:06   ` rustom
2009-06-12 12:24     ` Pascal J. Bourguignon
2009-06-12 12:25     ` rustom
2009-06-12 15:32       ` Giorgos Keramidas
2009-06-13  2:47       ` Barry Margolin
2009-06-13  6:43         ` rustom
2009-06-13  1:04 ` Joe Fineman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=07451191-d899-482a-b9e4-99bfb176898a@a5g2000pre.googlegroups.com \
    --to=rustompmody@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.