pj <pjdtech2...@gmail.com> writes:

> I would like it to indent like this:
>
> (defn calendar-initial-sync [server user mailfile password formula]
>   (with-session session hostname username password
>     (with-open-db session db dbname
>       (with-search-results db docs formula
>         (foreach-note docs doc
>
> Could someone help me figure out how to do this?

You have to teach Emacs that the with-* forms are macros that need
special indenting. You can do this using this snippet of elisp:

(define-clojure-indent (with-session 1)
                       (with-open-db 1)
                       (with-search-results 1))

Two caveats.

Unfortunately I still haven't figured out a way to get these indentation
rules to "travel with" the project; each person hacking on the project
will have to manually add them to his own personal config. Project-wide
settings files only work for setting variables, since evaluating arbitrary
code snippets just by opening a file is obviously a security
disaster. So toss them in the readme.

Emacs will only recognize literal calls to "with-session" etc. If you
qualify it by a namespace you will have to add the qualified identifier
as a separate indentation rule. Theoretically this could be hooked up to
the running Clojure instance to recognize macro calls with an arg list
that ended in & body, but I'm not sure it's worth the trouble.

-Phil

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