I created a service that adds “Edit in TextMate” to the Services sub menu. The key equivalent is command-escape (but there's an OS bug which requires the menu to have been open at least once before the key equivalent works).
It opens a TextMate window with the selected text, when you save and then close the TextMate window, the modified text will be sent back to the application.
There's currently a 3 hours timeout (the application will have the busy wheel until you close the TextMate window).
Place the service in ~/Library/Services -- you need to log out/in for the services menu to be rebuilt. If you launch the service manually, the service should be available for new programs or programs which hadn't already had the services menu built (but restart if it doesn't work).
If you use the service from within TextMate, it may hang (until you manually break the service) -- I'll add a workaround for this.
It currently can only handle one edit task at a time, and it requires at least version 1.0.2b3 of TextMate.
The reason that it's an external service and not built into TextMate has to do with the way services work -- I may be able to find a combined solution later.
It uses a temporary file for exchanging the text, this is always named “Data from <application>.txt” and placed in “/tmp/<uid>/TemporaryItems” -- it doesn't remove the file afterwards and it doesn't ensure that the file didn't already exist.
I totally love this service. Thanks!
A bug, though. I notice that when I use the service to edit something (in this case a textarea from a web page opened in OmniWeb), while that TextMate window is open, its process consumes as much CPU as it can get -- 80% - 90%, seemingly much more than a normal TextMate window editing a file. My load goes up, my fan comes on, etc. As soon as I save and close the service window, things go back to normal.
FYI, and thanks again.
On 8. Nov 2004, at 19:52, Chris Brierley wrote:
A bug, though. I notice that when I use the service to edit something (in this case a textarea from a web page opened in OmniWeb), while that TextMate window is open, its process consumes as much CPU as it can get -- 80% - 90% [...]
Ups... I had the run loop wait for the distant past, effectively creating a busy-loop. Here's an updated version: http://macromates.com/textmate/files/TextMate.service.zip
I btw think I've found a way to integrate this service in beta 4, so it won't have to be an external install.
According to Allan Odgaard:
Ups... I had the run loop wait for the distant past, effectively creating a busy-loop. Here's an updated version: http://macromates.com/textmate/files/TextMate.service.zip
You said it only supports one edit task at the same time. Does this mean that if you already have TM open (which I have all the time), the menu doesn't work?
I confess I have started it manually, not wanting to lose all my session by logout/login, it may make a difference.
On 9. Nov 2004, at 10:41, Ollivier Robert wrote:
You said it only supports one edit task at the same time. Does this mean that if you already have TM open (which I have all the time), the menu doesn't work?
Ah no -- by “edit task” I was only referring to using TM as a service. You can have all the files/projects open you want, but you can only use it as a service for one application at a time (but it's a limitation which I plan to remove of course).
Kind regards Allan
According to Allan Odgaard:
From: Allan Odgaard allan@macromates.com Ah no -- by ?edit task? I was only referring to using TM as a service. You can have all the files/projects open you want, but you can only use it as a service for one application at a time (but it's a limitation which I plan to remove of course).
Right. Then why is the service entry always unavailable unless TM is not running?
On 9. Nov 2004, at 11:01, Ollivier Robert wrote:
Right. Then why is the service entry always unavailable unless TM is not running?
It is?
This is not the case here -- I'm in TM now started from Mail, and TM was already running with several files open...
The service is unavailable if you haven't selected text, or in some applications, if the text selected is not editable, but other than that, it should be available.
According to Allan Odgaard:
This is not the case here -- I'm in TM now started from Mail, and TM was already running with several files open...
The service is unavailable if you haven't selected text, or in some applications, if the text selected is not editable, but other than that, it should be available.
Yes, after looking more into this, I've found that it varies from app to app. Mail.app has the option greyed out till I select something (which I found pretty annoying anyway).
Thanks and sorry for the false report.