Lee Spector <lspec...@hampshire.edu> wrote: >On May 20, 2011, at 3:30 PM, David Nolen wrote: >> Ah I thought you were talking about proper automatic indentation as >you enter in code not selective *re-indentation*. As far as I can tell >in the existing Clojure tools there are only varying degrees of >interpretation as to what constitutes proper Lisp formatting. >> >> But I've found this to be the case regardless of what combination of >programming language + editing tool I use. >> >> David >The reason that I think that this re-indenting feature is so important >is that I've found that it's often the most effective way to spot >simple coding errors: ask the editor to indent things appropriately and >if something looks odd it's because the syntax isn't what you thought >it was. The helps me quite a bit even after decades of Lisp >programming, and I've found it to be really valuable in a teaching >context. FWIW reasonable versions of this feature are available for >Clojure in (at least) emacs, Eclipse/Counterclockwise, MCLIDE, >NetBeans/Enclojure, TextMate, ..., but in my experience all of these >are somewhat outside of the sweet spot for other reasons. And some >version of this feature is available in most other Lisp/Scheme >environments (all that I've worked in, I think -- I've come to think of >it as completely standard and necessary for Lisp coding). The >implementations that I listed don't all agree on what the "correct" >indentation is, but they all have some version of this feature.
This is an important feature, and I had overlooked it - but does it have to be available in the editor? Remember, the goal is a "single download to clojure" with enough support to work on simple problems and get a feel for clojure, not anything that anyone might consider an optimal clojure develpment environment. So, instead of having an editor command region/function reindent to show the actual structure of the code, maybe you need to switch to a repl and run (indent-code "myfile.clj") to see what the structure really is. Actually, I would argue that that functionality ought to be in clojure to to provide a "standard" of sorts that various IDE's/editors can follow for indenting clojure. >BTW from what I can tell JEdit doesn't even do reasonable automatic >indentation as you enter code in the first place. If I type "(defn foo" >and hit return the cursor ends up under the second "o" in "foo", and >that seems pretty weird. If I type "(conj '(a b c)" and hit return it >lines up under the "a" which is even odder -- some would say it should >end up under the single quote (that'd be my vote in this situation), >while some would put it under the "o" or the "n", but I don't see any >rationale for it being under the "a". The goal isn't even as high as "reasonable" - it's "usable." So even the vi :ai feature - which indents to the first non-whitespace character of the previous line - would do. If we can get a more useable behavior with some smarts about adding more indentation (and I'd agree, an automatic 8-space indent doesn't qualify), so much the better. Also remember, the idea is that we *bundle* a properly-configured Jedit with the distribution. I chose Jedit because it was reasonably light-weight, written in Java (so it should run anywhere Clojure does) and has most of the right features. Problems experienced in getting it downloaded & configured should be circumvented by making sure everything works properly in what gets bundled, never mind if it's the latest, etc. I still consider it a stopgap until someone writes a lightweight IDE in clojure, ala Python's IDLE. -- Sent from my Android tablet with K-9 Mail. Please excuse my brevity. -- 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