The Grumpy Troll

Ramblings of a grumpy troll.

MacOSX launchd, MacVim, Chrome & EditWithEmacs

One of the biggest productivity enhancements you can make to a browser, when working with web-based services, is to add the ability to edit any text area in a real text editor. Today, I realised that I had not set this up on my work laptop, and my personal laptop is not with me so could not crib the setup. Since I've had to debug this twice, it's time to blog it for next time.

Ironically, Blogger does something weird with the edit box, so I can't use it for composing this post. Grr.

If using Firefox, set up the "It's All Text" extension; that will let you just set the program to invoke. For me, using Google Chrome, it's the EditWithEmacs extension. But Chrome does not let the extension run an arbitrary program. So you need to have a small daemon running as yourself, whenever you're logged in, which can invoke the editor for you.

Find the profile directory, to copy out the script:

$ cd "Library/Application Support/Google/Chrome/Default"; \
cd Extensions/ljobjlafonikaiipfkggjbhkghgicgoh/1.11_0/servers
$ ls

Copy that somewhere, make it executable, perhaps strip the quarantine (xattr -d

Install MacVim. Install the mvim helper too.

Create ~/Library/LaunchAgents/org.grumpy-troll.EditWithEmacs-pycl.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Then run:
$ launchctl load -S aqua org.grumpy-troll.EditWithEmacs-pycl.plist

Of note:
  • lets you pass arguments to the editor program, but it splits the editor name string on comma, to supply the multiple arguments
  • use ProgramArguments instead of Program, which does not split on whitespace.
  • Use full paths for the program and the program run from that, as the environ will be rather bare, without $PATH available.

-The Grumpy Troll
Categories: MacOSX vim plist launchd Chrome