You're right about indentation depending on the code being evaluated, but that's still better than nothing. ☺
People who do a significant amount of coding without a live session can still manually configure indentation like they currently do, and they're no worse off. The editor can even parse the metadata map present in the defn/defmacro, so as to provide some "offline" support (though I don't foresee Cider doing that). On 22 Sep 2015 11:31 am, "Phillip Lord" <phillip.l...@newcastle.ac.uk> wrote: > > > > Artur Malabarba <arturmalaba...@gmail.com> writes: > > Over at CIDER we're adding a feature where the author of a macro (or > > function) can specify how that macro should be indented by adding an > :indent > > metadata to its definition. This way the editor (and other tools, like > > cljfmt) will know what's the proper way of indenting any macro (even > those > > custom-defined) without having to hardcode a bajillion names. > > > One slight disadvantage with this approach is that the indentation can > change depending on the evaluation status of the code. Consider this set > of events inside emacs (I'll get back to Clojure -- it's a general > problem not Emacs specific). > > - I open the file lentic.el > - I type M-x indent-buffer > > Now, lentic.el depends on m-buffer.el which has some macros with > "declare" forms (the elisp equivalent to the metadata you are talking > off). And these are used in lentic.el. > > But I haven't loaded m-buffer.el yet. So the declare forms are not > active, so the m-buffer macros indent according to normal rules. Now, I > do > > - M-x eval-buffer > - M-x indent-buffer > > This loads lentic.el which loads m-buffer.el including the macros. So, > now I get different indentation patterns. Solution in Emacs space: force > loading on m-buffer.el whenever lentic.el is *opened* rather than loaded. > > Using metadata in Clojure the same situation will arise, but will be > somewhat worse. Indentation will be likely to behave differently > depending on whether the REPL is open and the evaluation status of any > macros. Given the slow start up time of the clojure REPL, this is > perhaps a more significant issue. The interesting question then is what > percentage of the time do Clojure developers work *without* a repl > active. > > Just a thought. > > 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 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.