[TxMt] Re: Edit in TextMate not working in Mountain Lion?

Fletcher Penney fletcher at fletcherpenney.net
Sat Aug 11 15:56:49 UTC 2012

On Aug 11, 2012, at 11:34 AM, Allan Odgaard wrote:

> On Aug 11, 2012, at 4:45 PM, Fletcher Penney wrote:
>> […] QuickCursor is a fantastic app (I would expect nothing less from Jesse), but the ODB protocol is outdated.  Brett Terpstra's nvAlt uses a different approach to handle a similar process that should be compatible with sandboxing rules in the future, and IMHO is a better approach.
> nvAlt seems to be his fork of Notational Velocity.

Correct - I forget not everyone uses nvAlt instead of NV...  ;)

> You mean he uses a different protocol to call upon external editors, or allow others to use nvAlt as editor?

Brett could explain it better, but my understanding from our conversations and my own testing is that when nvAlt calls on an external editor, it basically tells the other application to open the file in question.  nvAlt monitors that file, and if changes are saved, it updates the copy in it's database.  This means that the external editor does not even need to know it is being "used" in this way.  I discovered this when I found I could use my editor externally for nvAlt without any special coding - it just worked.

There are some potential issues that would need to be better defined:

* How long does an app continue to monitor a file before assuming it has been abandoned?
* What happens if the file is edited and saved, but left open?  ODB (IIRC) requires the document to be closed in order to send a signal to the original app that the file has been modified.  In this approach, that is no longer necessary.

>> When there is enough interest, I suspect there will be a successor to the ODB protocol that should be easier to implement and avoids all of the sandboxing issues.
> For the records, while TM2 supports ODB it also offers a socket interface which is what ‘mate’ and even ‘rmate’ (over ssh) use. I believe this should be compatible with App Store rules.
> In theory, other editors could implement the same protocol and users would be able to use ‘rmate’ with their editor of choice.
> Though it would probably be better to work together to define a protocol that everyone is happy with, but sockets is likely the way to go about it. This also means that one can install a launchd job to launch the application on demand — this can actually be made to work ATM so running ‘rmate’ over ssh will launch TextMate (if not already running).

I think a new standard is much needed.   I am not particularly invested in what that standard is, but think it should:

* Be easy for 3rd party developers to integrate - adding ODB support required more effort on my part than it should have, and the sample code was not really helpful

* Avoid Applescript

* Avoid requiring code in the external editor, if possible (Brett's approach in nvAlt, while not perfect, doesn't place any burden on the external editor - it simply opens and saves a file without having to be aware that another app is "pulling the strings")

* Be full compatibly with sandboxing rules, just in case


Fletcher T. Penney
fletcher at fletcherpenney.net 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4899 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20120811/b964ae3e/attachment.p7s>

More information about the textmate mailing list