sanity, inc.

simple thinking for complex software

Open "Txmt:" URLs From Rails Backtraces Using Emacs on OS X

When Rails prints a backtrace in HTML, it’s helpfully rendered as a “txmt:” link so that users can click open the corresponding location in TextMate on OS X. If you’re an Emacs user, here’s how to make those URLs open in Emacs instead.

First, get a copy of Daisuke Murase’s emacs-handler project using git or by downloading a tarball.

Then apply the following patch:

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/Info.plist b/Info.plist
index 1880412..deb1fa4 100644
--- a/Info.plist
+++ b/Info.plist
@@ -8,6 +8,7 @@
                        <key>CFBundleURLSchemes</key>
                        <array>
                                <string>emacs</string>
+                               <string>txmt</string>
                        </array>
                        <key>CFBundleURLName</key>
                        <string>org.unknownplace.emacshandler</string>

Alternatively, you can just check out my clone of emacs-handler, which has the above patch built-in.

Finally, open the project in Xcode, and build it. Fire up the resulting EmacsHandler.app, and edit the app’s preferences to point to your Emacs.

That should be all you need to do – just keep EmacsHandler.app around somewhere on your Mac.

Comments