Hi,

On 17 Mrz., 16:24, Lee Spector <lspec...@hampshire.edu> wrote:
> Does anyone know of a concise description of the default rules that SLIME 
> uses to auto-indent code? I'd like to tell the Bluefish community what it 
> would be nice to have in their Clojure mode. I've tried some web searches and 
> found this surprisingly hard to dig up -- tons of stuff on customizing it or 
> getting it working (or noting that "it just works") but no clean lists of 
> "this gets formatted like that" rules.
>
> Here are the best partial or otherwise not quite right things I've found 
> (e.g. because there's a lot of other style advice mixed in):
>
> http://www.labri.fr/perso/strandh/Teaching/MTP/Common/Strandh-Tutoria...http://linux.about.com/od/emacs_doc/a/emacsdoc277.htmhttp://mumble.net/~campbell/scheme/style.txt
>
> Seems like there ought to be a more straightforward description of what SLIME 
> does by default somewhere...

I believe the Vim indentation for Lisp works quite similar to the
emacs one. The basic heuristic - as I understood it - is:

1. Only one word after the opening paren in previous line: align with
innermost unmatched ( + 2 spaces
   (bar
     | <- cursor below a
2. There are more than one word after the opening paren, but the form
is a macro/special form with a body (eg. do, try, catch, let, def*,
with-*, binding, etc., also: if, condp, ...): align with innermost
unmatched  ( + 2 spaces
   (let [xxx yyy]
     | <- cursor below e
   This is a bit fuzzy, but you should get the idea, what is meant.
3. There are more than one word after the opening paren, but not a one
of the cases of 2.: align below first argument of innermost unmatched
(.
   (foo bar
        | <- cursor below b
4. Inside vectors, maps and sets: align with innermost unmatched  [/
{ + 1 space
   [bar
    | <- cursor below b

This is roughly how VimClojure indents the code.

Sincerely
Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to