Collaborative editing with Emacs

This note is about using Emacs for collaborative editing with help of package called crdt.el.

Emacs preparations

Install crdt package, it is simple with use-package:

Hit C-x C-e in your Emacs configuration after typing this

(use-package crdt :ensure t)

Check your crdt.el version. Because readme of crdt.el says:

Please make sure that you and your peers are on the same crdt.el version! It turns out to be one of the most common causes of crdt.el not working. Because currently the network protocol is not stablized, behavior when using mismatched versions is unexpectable.

We could get crdt.el version from crdt-protocol-version variable using ielm REPL.

ELISP> crdt-protocol-version

This are the steps every collaborator should do. Now let’s see what a collaborative session starter should do.

Session starter side

As a session initiator (you will host a server) you should:

  • pick some buffers you want to share
  • switch to first buffer and M-x crdt-share-buffer
  • then execute same command inside other buffers

You will be asked about:

  • port
  • password
  • display name

Then server will be started. You could list some objects:

  • crdt-list-sessions active sessions
  • crdt-list-buffers shared buffers
  • crdt-list-users connected users

Collaborator side

As a collaborator (you will connect to the session starter server) you should just call crdt-connect.

Then you will be asked for:

  • url (ip address or hostname)
  • port
  • your name
  • password

Here you could see how two windows of Emacs with single crdt.el session looks like:

Using your VPS to connect to each other

While crdt.el supports toxvpn, but it is not working for macos collaborators very well. We will setup VPS just for collaboration and use SSH tunnels to secure communication.

Session starter should:

Where x.x.x.x is you VPS IP address

$ ssh -N -R root@x.x.x.x

Then collaborators should:

Don’t forget to add your collaborators public SSH keys to authorized_keys file

$ ssh -N -L 6530: root@x.x.x.x


  • sly-mrepl is not working properly (error in minibuffer says readonly text)
  • sly-mrepl has no colors on collaborator side