How to open textmate links in Emacs on OS X
Posted 23 Jan 2009
I must admit that I’ve had some jealous feelings lately, watching developers using texmate. It wasn’t the editor which impressed me, of course, but the support they get out of using the footnotes plugin.
However, as a dedicated member of the church of emacs, I muttered to myself: “dammit, it must be possible to invoke the one true editor instead”, even on a Mac.
And indeed, it’s possible. Here’s how to do it.
First, open the the Info.plist file of the Emacs you installed (for me it’s in /Applications/MacPorts/Emacs.app/Contents/Info.plist). Find the lines which look like
<key>CFBundleURLSchemes</key>
<array>
<string>mailto</string>
</array>
and add txmt urls:
<key>CFBundleURLSchemes</key>
<array>
<string>mailto</string>
<string>txmt</string>
</array>
Second, download textmate-links.el, install it into your Emacs load path and add (require ’textmate-links) to your init.el.
Third, get RcDefaultApp if you haven’t installed it already. This will allow you to associate txmt: urls with Emacs. Open it and select the Applications tab. Navigate to Emacs and check the txtmt checkbox and select it as the default appplication for txmt urls.
Then navigate to the Urls tab and select Emacs as the handler for txmt urls, if this hasn’t happened automatically already.
Next time you click on a txmt: link in the browser of your choice, it should open the file in Emacs.
Enjoy!