Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I spot subtle Lisp syntax mistakes?
    primarykey
    data
    text
    <p>I'm a newbie playing around with Lisp (actually, Emacs Lisp). It's a lot of fun, except when I seem to run into the same syntax mistakes again and again.</p> <p>For instance, here's something I've encountered several times. I have some <code>cond</code> form, like</p> <pre><code>(cond ((foo bar) (qux quux)) ((or corge (grault warg)) (fred) (t xyzzy))) </code></pre> <p>and the default clause, which returns <code>xyzzy</code>, is never carried out, because it's actually nested inside the previous clause:</p> <pre><code>(cond ((foo bar) (qux quux)) ((or corge (grault warg)) (fred)) (t xyzzy)) </code></pre> <p>It's difficult for me to see such errors when the difference in indentation is only one space. Does this get easier with time?</p> <p>I also have problems when there's a large distance between the (mal-)indented line and the line it should be indented against. <code>let</code> forms with a lot of complex bindings, for example, or an <code>unless</code> form with a long conditional:</p> <pre><code>(defun test () (unless (foo bar (qux quux) (or corge (grault warg) (fred)))) xyzzy) </code></pre> <p>It turns out <code>xyzzy</code> was never inside the <code>unless</code> form at all:</p> <pre><code>(defun test () (unless (foo bar (qux quux) (or corge (grault warg) (fred))) xyzzy)) </code></pre> <p>I auto-indent habitually and use parenthesis highlighting to avoid counting parentheses. For the most part it works like a breeze, but occasionally, I discover my syntax mistakes only by debugging. What can I do?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload