SWAT /

Emacs And Chrome

Reading

Outdoors

Games

Hobbies

LEGO

Food

Code

Events

Nook

sidebar

Emacs And Chrome

emacs and Chrome

Firefox having become terribly bloated and as slow as the browsers it was created to demolish, I've switched to Chrome. To do this I needed two things:

  • del.icio.us plugin;
  • Support for editing textareas in emacs, just like It's All Text in Firefox.

Fortunately, an official extension for the del.icio.us buttons was eventually created.

For the second a couple packages exist; I do the following.

Extension

I use the Edit with emacs Chrome extension to handle the browser UI. It installs painlessly and seems to work without problems. I kind of wish the edit buttons were on the bottom right of the textareas, but that's a minor quibble.

Server

Rather than running an HTTP server inside emacs to take the commands, I run a standard emacs server and run a separate script to parse and pass commands and results to and from. I use Perl script from the TextAid Chrome extension for this. It's available at http://opencoder.net/edit-server and locally cached here. Note that you need to either change the port in edit-server or in the Edit with Emacs extension as the defaults don't match. The file also defaults to vim as the editor, so comment out that line, uncomment the emacsclient line, and remove the '-c' option from the command. I also turned off the edit-server authentication as it did not work off the bat.

The main reason for taking this approach is that the server code that Edit with emacs uses does not seem to run correctly on many versions of emacs. There are a few problems with the signatures of the networking functions used. In the end I couldn't fix those problems in a couple minutes and it wasn't worth diagnosing further as this approach works flawlessly.

Startup

To bring the whole thing together, instead of running Chrome directly I launch a trivial shell script that starts Chrome, the HTTP server, and an emacs server, and takes them down cleanly when Chrome exits. It looks like this:

#!/bin/bash

/opt/google/chrome/edit-server &
pid_edit=$!

emacs -f server-start &
pid_emacs=$!

/opt/google/chrome/google-chrome $@

kill $pid_emacs
kill $pid_edit

Wrap-up

That's about it. At first I thought it more cumbersome to have to switch over to the emacs server window to edit, as opposed to the Firefox It's All Text plugin popping up a new emacs window. However, I quickly got used to that, and it's definitely noticeably faster than spawning a new emacs all the time. In addition, Chrome itself is just a lot, lot faster than current Firefox and much more stable with the self-contained process tabs, so all in all it's a much better experience.

Recent Changes (All) | Edit SideBar Page last modified on October 19, 2010, at 02:24 PM Edit Page | Page History