Collaborative Editing

Eclipse Day at the Googleplex: Wiring Hacker Synapses

This Google Tech Talk goes over the algorithm Eclipse Ganymede uses for collaborative text editing. This feature allows two people to connect to the same file and make changes to it, with each person’s changes being reflected in the other person’s document. This is not difficult until changes start conflicting with each other: How do you preserve the meaning of edits when, due to latency issues, editing instructions may occur out-of-order? This presentation addresses that issue.

This presentation made me think of how to use Emacs for collaborative editing. A few thoughts and searches led me to several options:

The first option to use Emacs for collaborative editor is to use GNU Screen. Screen is a terminal multiplexor, allowing features such as multiple shells, multiple connections to a screen instance, and many other features. I’ve been meaning to get around to learning screen for a while; even though I mostly use run shells inside Emacs, solving many issues, Screen still seems like it would be useful to know. To perform collaborative editing in Emacs with Screen, just have one person start a screen instance, run ‘emacs -nw’, and have the other person connect to the same screen instance, probably via SSH. This will allow both users to view and edit the document at the same time.

Emacs can also spawn a new frame on any X display using the make-frame-on-display function. Just pass the function which display to use, and a new frame will pop up in that display. Since both frames will be running the same Emacs instance, each person connected will be able to see changes and edit in real time. Users can still affect each other, however; changes to the emacs session will be effected over all connected clients, and closing emacs will kill it for everyone.

There are certainly other ways to do collaborative editing within emacs: Just look at The EmacsWiki page on Collaborative Editing for more.

Tags: ,

Leave a Reply