I'm using TextMate with OCaml extensively, and use an Eval script from Johan Kullbom to send either a selection or a current line to an iTerm with ocaml interpreter in it (adapted from F#):
http://blog.hoomla.se/post/F-TextMate-bundle-on-Google-Code.aspx
The problem is, OCaml grammar doesn't really show functions properly, fold-unfold handles make no sense. Thus, I have to select a function manually if I want to send it to ocaml.
Now I chose "Line" in Input: [Selected Text] or [Line], but what I'd really like to choose is "Non-blank line segment around the cursor". I'm not sure what can I do with the [Scope] there, as scopeName defines the whole 'source.ocaml', AFAICU.
So, is there a way to achieve "select Non-blank line segment around the cursor, then send THAT to ocaml using an Eval snippet or similarly"?
Cheers, Alexy
On 30 Nov 2008, at 21:17, Alexy Khrabrov wrote:
[...] Now I chose "Line" in Input: [Selected Text] or [Line], but what I'd really like to choose is "Non-blank line segment around the cursor". I'm not sure what can I do with the [Scope] there, as scopeName defines the whole 'source.ocaml', AFAICU.
Scope selector would be selecting scopes based on the grammar, so if the grammar doesn’t give a unique/selectable scope to the function, this option is not useful.
So, is there a way to achieve "select Non-blank line segment around the cursor, then send THAT to ocaml using an Eval snippet or similarly"?
You might be able to pull it off using a macro, alternatively you could take entire source as input and look at TM_LINE to figure out (in the command’s code) what to actually execute (similiar to Ruby’s Run Focused Unit Test).