Have a look at stakeout: http://michael-mccracken.net/blog/ blosxom.pl/2004/07/28 This will allow you to have your script notified when the file is saved (but not closed, for which there is mate -w).
good tip -- thanks. yes, with a combination like that i can probably get close to what i was looking for, but i still think that it would be a lot cleaner for TM to support this more directly.
As for receiving AppleScript events from a shell tool, that's not really possible AFAIK because the sender needs to have the receivers four character code, which is something only “real” applications have.
right, which is why i was asking for a non-applescript API.
(i think what i'd *really* like is to have a lua interpreter embedded in TM, but in the absence of that we should be able to do almost everything with external programs...)