[TxMt] Use begin marker of a scope to end the previous one
Pierre Morel
pier.morel at gmail.com
Mon Mar 16 09:44:57 UTC 2009
Hello,
I'm trying to enhance the Matlab bundle. Especially by trying to make
matlab and texmate to interact (shortcut to launch a script etc...).
And I must say I'm pretty bad with shell scripts and regular
expressions.
I've nevertheless managed to do that, and now I'm trying to recreate
matlab "cell mode" : matlab source files are scripts, and it is
possible to divide the script in "cells". When you are in the (awful)
matlab editor, you can run the current cell just with cmd+enter. This
is very useful. The problem is that the cell separator is just a line
like this :
%% Title of the new cell
...That's it, there is no ending marker for a cell : the current cell
ends where the new one starts ! What I've done now is creating a new
"cell" scope delimited by these lines, but as soon as one "%% ...."
line is used to mark the end of a scope, it can't be used to start the
following one.
Here's my descriptor.
contentName = 'meta.cell.matlab';
begin = '%%.*$\n';
end = '%%.*$\n';
captures = { 0 = { name = 'meta.celltitle.matlab'; }; };
patterns = (
# Here I include all the other scope descriptors, because they can
be contained in a cell !
)
For my solution to work, I then have to use two of these "%% ..."
lines, one to end the previous cell scope, and one to start the new
one. This means matlab files need to be modified to work, which is not
so good !
Do you have an idea on how to solve this problem ?
A linked problem (but less important) is that I can't get code folding
to work with cells : a start marker can't be the same as an end marker.
Thank you !
More information about the textmate
mailing list