[TxMt] Run command on Event and other stuff
allan at macromates.com
Fri Aug 5 08:55:28 UTC 2005
On 04/08/2005, at 8.47, Tim Shadel wrote:
> [...] I want to write a sensor to collect these metrics from
> TextMate. The basics would be: 1) log when a new file is opened,
> 2) log when a file is closed, and 3) every so often (30 seconds)
> log which file is in the active window. Pretty simple.
Currently there are no hooks for these things, but it could happen
through a plugin. Something which is soon to debut -- are you
familiar with writing Objective-C? if so, I'd suggest subscribing to
textmate-plugins  (and there should soon be the required
notifications by means of a plugin).
> [...] I've seen several items about launching command-line programs
> from TM, but can I keep one open in the background?
If your command launches a new process, that process will continue to
run after control is returned to TextMate.
If you want to provide an interface to control the process then you
control shell commands. I added an example command to the
experimental bundle  which opens a window with the time (updated
each second) that you can start/stop.
> Can I intercept the File | Open actions and then record my metrics? I
> haven't seen how to do this in other posts.
No, that's currently not possible, but as implied above, I don't mind
providing the necessary notifications (as NSNotification's that an
Objective-C plugin can observe).
More information about the textmate