04.20.06
More Spreadsheets in TextMate!
In the previous post I talked a bit about the Spreadsheet bundle. Now it is ready for some beta testing! Here’s a small screencast demonstrating some basic functionality. The syntax for the expression is similar to the standard Spreasheet syntax. You can use dollar signs also, to indicate cells that do not change.
Update 3 Here’s a new screencast, for the updated bundle. Please update to the new version, it’s very much improved.
Here are the files. Sorry, not much documentation yet, but feel free to post your questions here. Here’s a screenshot:

Update 1: I should mention that I am using vertical bars “|” for the cell delimiters, instead of tabs, because tabs did not allow for the textmate variables accurately describing the cell that the cursor is located at. Also, if you want to color the cells and the delimiters then you’ll want to set colors for the scopes “meta.cell” and “meta.cellend.tab” respectively. Finally, you can have comment lines that start with the hash symbol “#”.
Update 2: I just updated the bundle, and it now has a lot more ruby support. First off, you can have it execute one liners of the form “%r aRubyCommandHere”. There are executed by the Spreadsheet instance. You can access the data by calling data. So “data[4][5]” will return the entry in E5. To set values, use set_data. so both “set_data([4,5],28)” and “set_data(”E5″,28)” will set the value of E5 to 28. Atm the whole program must be in one line I’m afraid.
The other way is to add to the built in functions. The file commands.rb contains the module ParserDelegateMethods. This module is being loaded into ParserDelegate. If you add to this module a command like:
def foo(array)
dosomethingwitharrayandreturnvalue
end
then in your files you could use FOO(2,3,4) to call this command.
IMPORTANT: This new version of the bundle requires vertical lines at both ends of the table. Running the reflow command should add those automatically.
Later