The current Scheme (and Lisp) plugins don't seem to format according to the normal usage for these languages.
With the following text in TextMate in Scheme mode you get:
----- (define (x y) (let ((a 1) (b 2)) (+ (* a b) y))) -----
This is hard to see in mail unless you have plain text w/fixed pitch on... but paste it into TextMate and align it with Scheme selected.
Normally, the 'a' and 'b' in the 'let' form would align and the '(' before the '+' and the '(' after 'let' would align.
TextMate makes a mess of this, though. I've looked over the language definitions, but it would seem there is a pretty steep learning cliff and I'd expect that this really should be working already, so I thought I'd check if this is supposed to work or if this is a known deficiency.
I can make the formatting at least look properly structured if I drop closing parens onto their own lines, but this results in tons of wasted space:
---- (define (x y) (let ( (a 1) (b 2) ) (+ (* a b) y) ) ) ----
Any hints? Thanks!
-tim
On Thu, 21 Dec 2006, Timothy J. Wood wrote:
The current Scheme (and Lisp) plugins don't seem to format according to the normal usage for these languages.
Unfortunately, the indenting ability of TextMate is pretty bone simple in that it really just looks for syntactic clues that it should indent or unindent, but it doesn't offer any ability to compute how far to indent/unindent outside of one level right or left. (unless, of course, I missed yet another neat feature addition by not carefully reading the change logs).
I believe that in order to fix this, you'll need to wite a commond that can do some intelligent processing of the code to indent it properly.
William D. Neumann
---
"There's just so many extra children, we could just feed the children to these tigers. We don't need them, we're not doing anything with them.
Tigers are noble and sleek; children are loud and messy."
-- Neko Case
Life is unfair. Kill yourself or get over it. -- Black Box Recorder
Timothy J. Wood wrote:
The current Scheme (and Lisp) plugins don't seem to format according to the normal usage for these languages.
With the following text in TextMate in Scheme mode you get:
(define (x y) (let ((a 1) (b 2)) (+ (* a b) y)))
Yeah, unfortunately you can't really do what you want with the built-in indentation tools. I think with some clever commands, it should be possible to do however you like, but TextMate's indentation machinery isn't really designed to be super flexible. That may change in future versions... we'll have to wait to see what Allan comes up with. Until then, I think your best bet is to make some simple (or maybe complex) commands that take in the whole file, and then examine the previous lines to determine indentation, and then set those to run when you press return, etc.