Lee, while we're at it.

I decided to finally give it a try, and so I implemented an alternate
behaviour for smart indent for ccw : the version of the gist does the
following : it uses the following function to test whether we should indent
by 2 or align with the first call argument :

(def lisp-forms (into #{} (map str '(let fn binding proxy reify extend
extend-protocol extend-type bound-fn
                            if if-not if-let when when-not when-let
when-first condp case loop dotimes
                            for while do doto try catch locking dosync doseq
dorun doall
                            -> -?> >> future ns clojure.core/ns gen-class
gen-interface))))
(defn ^{:doc "Returns logical true if the String probably names a special
form or macro var"}
  lisp-form? [s]
  (or
    (.startsWith s "def")
    (.startsWith s "with")
    (lisp-forms s)))

The gist is here : https://gist.github.com/875245

To test it with CCW 0.2.0.RC08, you just need to replace the content of the
file :
/path/to/your/eclipse/plugins/paredit.clj_0.12.5.STABLE01/paredit/core.clj
with the content of the gist.

Hope you'll like it, and, as usual, open to feedback (it passes paredit's
automated test suite, but I haven't played a lot with it from ccw).

Cheers,

-- 
Laurent

2011/3/17 Lee Spector <lspec...@hampshire.edu>

>
> 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-Tutorial/indentation.html
> http://linux.about.com/od/emacs_doc/a/emacsdoc277.htm
> http://mumble.net/~campbell/scheme/style.txt
>
> Seems like there ought to be a more straightforward description of what
> SLIME does by default somewhere...
>
> Thanks, -Lee
>
> --
> 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

-- 
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