Dear All, Is there anyway to "tie" actions in other applications to actions in Textmate? For example, I'd like the opening of a new file in Textmate (by the file menu or input manager) to also initiate my timer program (through an applescript, probably).
Is this possible?
Thanks, Zvi Biener
On 23. May 2007, at 11:12, Zvi Biener wrote:
Is there anyway to "tie" actions in other applications to actions in Textmate? For example, I'd like the opening of a new file in Textmate (by the file menu or input manager) to also initiate my timer program (through an applescript, probably).
Is this possible?
There is no system for this, but it could probably be done by creating a TM plug-in which observes the right conditions.
On May 23, 2007, at 10:43 AM, Allan Odgaard wrote:
On 23. May 2007, at 11:12, Zvi Biener wrote:
Is there anyway to "tie" actions in other applications to actions in Textmate? For example, I'd like the opening of a new file in Textmate (by the file menu or input manager) to also initiate my timer program (through an applescript, probably).
Is this possible?
There is no system for this, but it could probably be done by creating a TM plug-in which observes the right conditions.
Could this also be done through a Bundle Command, with the new document created and the timer launched by running the command?
B.
On May 23, 2007, at 1:57 PM, Brooks Seymore wrote:
Could this also be done through a Bundle Command, with the new document created and the timer launched by running the command?
B.
Yeah, you can trigger a Applescript when you run a bundle command or even include run it from the script used when creating a file from a template so creating a new file would start the timer, but then you wouldn't be able to log time if you were just editing existing files.
I haven't had time to look into it for myself, but does anyone else know if you can just use launchd to watch a TextMate related file for changes, say, the TextMates preferences for example? If the file is modified you can assume you're working with TM & then start your timer? I know launchd can monitor paths, but I don't know if TM alters its prefs file on disk when its running or just when it shuts down or what. If so it'd maybe work to use launchd to watch the prefs file and run a script. The script could even maybe use
defaults read com.macromates.textmate NSRecentDocumentRecords
to examine what documents were last opened / saved and mess with your timer accordingly, though you'd have to translate them from alias references (or whatever the heck the prefs file stores) to paths somehow. Thats beyond me at the moment.
I'm just tossing out ideas...
- Cliff
On May 23, 2007, at 1:43 PM, Allan Odgaard wrote:
There is no system for this, but it could probably be done by creating a TM plug-in which observes the right conditions.
Hmmm... Is there a good place to get any info on developing TM plugins? I've seen plenty for bundles but not much of anything on plugins. I'm just moving more into Cocoa & I'd like to "fiddle" with a plugin if I can find some info on it.
- Cliff
On 23. May 2007, at 21:11, Cliff Pruitt wrote:
On May 23, 2007, at 1:43 PM, Allan Odgaard wrote:
There is no system for this, but it could probably be done by creating a TM plug-in which observes the right conditions.
Hmmm... Is there a good place to get any info on developing TM plugins? I've seen plenty for bundles but not much of anything on plugins. I'm just moving more into Cocoa & I'd like to "fiddle" with a plugin if I can find some info on it.
Well, the manual: http://macromates.com/textmate/manual/appendix#plug- in_api
Though it basically says there is no API ;)
Creating plug-ins require a fair bit of knowledge about the Cocoa framework, as TM itself doesn’t add to it, but rather relies on you to know your way around this framework, and how to “hack” it to inject your code in the proper places -- that said, on the plug-in ML I do give out internal info whenever it helps people achieve their goals, but I do not promise to keep the APIs the same for 2.0 (which should make things a bit more open to plug-in developers).
:-) Well, yeah I did read the _extensive_ documentation in the manual about plugins (j/k) but I was just curious if someone that had gone through the process had volunteered any "getting started" advice. For example the code browser plugin deals with the current document which means it must somehow read the documents contents. I know there are plenty of tools & ways to have Cocoa tell you what's going on, but for a beginner that's getting in a little in over my head at the moment. Maybe plugins will have to wait until I am a little further down the road with Cocoa.
I can't quite even figure out how to make sense of the stinkin debugger yet. ;-)
- Cliff
On May 23, 2007, at 6:13 PM, Allan Odgaard wrote:
On 23. May 2007, at 21:11, Cliff Pruitt wrote:
On May 23, 2007, at 1:43 PM, Allan Odgaard wrote:
There is no system for this, but it could probably be done by creating a TM plug-in which observes the right conditions.
Hmmm... Is there a good place to get any info on developing TM plugins? I've seen plenty for bundles but not much of anything on plugins. I'm just moving more into Cocoa & I'd like to "fiddle" with a plugin if I can find some info on it.
Well, the manual: http://macromates.com/textmate/manual/ appendix#plug-in_api
Though it basically says there is no API ;)
Creating plug-ins require a fair bit of knowledge about the Cocoa framework, as TM itself doesn’t add to it, but rather relies on you to know your way around this framework, and how to “hack” it to inject your code in the proper places -- that said, on the plug-in ML I do give out internal info whenever it helps people achieve their goals, but I do not promise to keep the APIs the same for 2.0 (which should make things a bit more open to plug-in developers).
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On Thu, 24 May 2007, Cliff Pruitt wrote:
:-) Well, yeah I did read the _extensive_ documentation in the manual about plugins (j/k) but I was just curious if someone that had gone through the process had volunteered any "getting started" advice. For example the code browser plugin deals with the current document which means it must somehow read the documents contents. I know there are plenty of tools & ways to have Cocoa tell you what's going on, but for a beginner that's getting in a little in over my head at the moment. Maybe plugins will have to wait until I am a little further down the road with Cocoa.
Also, take a look at some of the other plugins on the Wiki page at http://macromates.com/wiki/Main/Plugins. I didn't see any source code for CodeBrowser, but some of the others offer source. TabMate, for instance, looks at the top line of the file for a magic string, then sets tab width and hard/soft tabs according to that string. It has no UI, so there shouldn't be any Cocoa voodoo to deal with. I poked at the source a little myself, but Objective-C just looks bizarre to me. I decided to wait until TM2 before getting my hands dirty with it.