There used to be a really great Mac text editor called Alpha that was fully scriptable in Tcl. The only annoying thing about it was that after you had paid for it (shareware) the author wouldn't provide a build with the nagging switched off. Maybe that's one reason it seems to have vanished.