Version: (using KDE 4.3.1) OS: Linux Installed from: Unlisted Binary Package Here's a lisp indenter which is a little different and, to me, more usable. It assumes that everything is a function or an argument to a function and indents forms accordingly. It has no knowledge of special forms or macros, so it never indents correctly things like "(when condition body)". This is annoying but can be fixed manually and the indenter is smart enough to keep the indentation of the surrounding lines, if it makes sense. On the other hand not relying on a list of language-specific symbles makes this indenter truly language agnostic. It would be great if kate scripts would offer a callback for when the unindent key is pressed: scripts could offer an alternative indentation instead of the current lisp-unfriendly behaviour.
Created attachment 36850 [details] The indentation script
Created attachment 36887 [details] The indentation script, v1.1 Better behaviour for some Common Lisp special forms (cond, let, ...).
Created attachment 36888 [details] The indentation script, v1.1 (for real) Oops, wrong file.
Hi, I once wrote the Lisp indenter but just as a proof of concept. I have no idea whether it's really useful for programming Lisp. Hence, does it make sense to replace it? Or add yours as another "Lisp2" indenter (with a better name)?
Well, the part that indented comments was good and in fact I used it. On the other hand, it is not really usable for lisp programmers since it indents everything by a fixed amount. Readable lisp code is a little bit more convoluted since it must convey the structure of the program, thus offsetting the homogeneous syntax. My approach is still a little trivial, but is somewhat usable. Of course opinions of other lisp (or scheme) developers are most welcome.
Well, I'd be fine with replacing my indenter then. I doubt other lisp programmers read this thread, so if we want feedback we'd have to ask directly in lisp communities or blog about it.
Ah, just stumbled over bug #147693. Can you have a look? Probably we can close that one then.
I posted a link to this bug on comp.lang.lisp and on the clojure group. Unfortunately it seems most developers are happy with emacs; I'm not going to blame them. Yes, bug bug #147693 is partially solved by my indenter. Unfortunately there are some technical limitations which make a "perfect" lisp indenter non-trivial. Good improvements would be possible if Kate would call the indent() function (or another callback... unindent() maybe?) in response to an unindent command (backspace or shift+tab). Adding a backspace character to triggerCharacters doesn't seem to have any effect right now.
Git commit bc6dcd8ad017908b951fb379c706efd5913f4c31 by Christoph Cullmann. Committed on 12/08/2011 at 15:38. Pushed by cullmann into branch 'master'. add new lisp indenter, feel free to mail further improvements BUG: 207002 M +79 -34 part/script/data/lisp.js http://commits.kde.org/kate/bc6dcd8ad017908b951fb379c706efd5913f4c31