TextMate (MacOS X)

Started by cormullion, August 04, 2006, 04:09:49 AM

Previous topic - Next topic

cormullion

I've been trying out the text editor called TextMate http://macromates.com/">//http://macromates.com/. It's good.



Although TextMate isn't newLISP-aware immediately, you can teach it the language. You define various language patterns using regular expressions, then it can format and work with your code with a bit more intelligence. m i c h a e l has been teaching it the basics, and they work well. I've been struggling to add function pop-ups to his work, and I've half-succeeded. It's tough work, struggling with so many regular expressions at once:


{ scopeName = 'source.newlisp';
comment = ';';
firstLineMatch = '^#!/.*bnewlispb';
fileTypes = ( 'lisp', 'lsp' );
patterns = (
{ name = 'comment.line.newlisp';
match = ';.*$';
},
{ name = 'comment.line.number-sign.newlisp';
begin = '#';
end = '$';
},
{ name = 'meta.function.newlisp';
begin = '((defines+)(((?![#;"''(){}.,0-9])[^"''(): ]+)';
end = ')';
beginCaptures =
{ 1 = { name = 'keyword.control.define.newlisp'; };
2 = { name = 'entity.name.function.newlisp'; };
};
patterns = (
{ name = 'variable.parameter.newlisp';
match = '((?![#;"''(){}.,0-9])[^"''(): ])+';
}
);
},
...etc

All the information about newLISP is stored in a file called a 'bundle', and you can easily email these to people, or edit them in TextMate, although they're not text files.



Developing a TextMate bundle for newLISP could be considered to be a communal effort, as it gradually gets improved and extended with the contributions of many* different individuals. But how best to organize this? The TextMate community has some kind of source management system running so that different people can update a bundle with their contributions. This requires the installation of a source control management system (subversion?) though, which I'm not sure I'm up to.



Is there another way for us to develop the TextMate bundle jointly, or is it better to go with the TextMate method and get into subversion...?



* As far as I know there are only 2 people currently using newLISP and TextMate, but I might be wrong, and besides Steve Jobs might announce that newLISP is the new AppleScript... ;-)

cormullion

#1
Some sort of follow-up at http://newlisper.blogspot.com/">//http://newlisper.blogspot.com/

m i c h a e l

#2
Hi cormullion,



Thank you for all your hard work on the newLISP bundle. (And I do mean hard. Regular expressions are a bitch-goddess! If you don't already have it, Jeffrey Friedl's http://www.amazon.co.uk/gp/product/0596528124/026-2228346-0361256?v=glance&n=266239&s=gateway&v=glance">book is a must.) As to how to go about collaborating on the bundle, I'm not sure either. At this point, if I make any major changes, I could just email the bundle to you. This is not ideal (what if we make changes that conflict with each other's unknown changes?), but until you or I figure out Subversion, that may be the easiest way to go. I would like to see a newLISP bundle standing proudly along with the other languages at the bundle repository, though :-)



I did need to make a few little changes to get it to work for me. Added:


scopeName = 'source.newlisp';
fileTypes = ( 'lsp', 'lisp' );


here:


{ scopeName = 'source.newlisp';
fileTypes = ( 'lsp', 'lisp' );
patterns = (
{ name = . . .

         

A minor thing, but the bundle name (within the bundle editor) was untitled (literally), as was the language name.



Finally, I noticed define(-macro)? within support.function.newlisp's match. This seems unnecessary since we are already grabbing it with meta.function.newlisp's match.



Also, the new default argument syntax is confusing meta.function.newlisp's match now!



BTW: In case you didn't know about this already, in the TextMate bundle, there should be a command called Show Scope. With the cursor on the part in question, Show Scope will display a tooltip with the scopes applying to that text. Vital when doing the work you've been doing. Sorry for not mentioning it sooner :-(



I'll try to hack away at this when I can, and maybe between the two of us (and a little help from some kind regex guru), we can make this a confident little bundle.



Thanks again, cormullion.



m i c h a e l



P.S. As I started to work on the newLISP bundle, I remembered I had downloaded a helpful program called http://www.apple.com/downloads/macosx/development_tools/cocoaregex.html">CocoaREGEX. Very simple program, but it makes it easy to quickly see what your regexes are actually doing.

cormullion

#3
Way to go! (As we say over here these days.) Thanks for your efforts too. Two minds may well be better than one in this case, especially when one of them doesn't really understand what's going on.



There's a train line that goes along the coast of Norfolk, and at one point two tracks merge into one, and continue along a single track for a dozen miles before dividing again. To prevent two trains from attempting to travel down this track at the same time, the drivers have a large piece of wood with a metal ring through one end - a giant key or 'staff'. Only when a driver has this in his hands can he proceed. At the end of the single track, the key is handed over - with disappointingly little ceremony - to the other driver who is then empowered to use the stretch of track. Obviously it's been decided that it just isn't worth trying to automate this handover - it works too well.



Please consider yourself to be the holder of this giant newLISP TextMate bundle, lovingly hewn out of solid Regex hardwood for the coming weeks, while my train is in the sidings...



:-)

m i c h a e l

#4
> Please consider yourself to be the holder of this giant newLISP TextMate

> bundle, lovingly hewn out of solid Regex hardwood for the coming weeks, while

> my train is in the sidings...



"Okay." (said with disappointingly little ceremony ;-)



m i c h a e l