views:

55

answers:

3

This page from the Emacs manual describes a function called make-frame-on-display that allows you to access a remote Emacs session. My interest in this function is to use it to share buffers for pair programming remotely with a colleague.

From the page:

It is even possible to use this feature to let two or more users type simultaneously on the two displays, within the same Emacs job. In practice, however, the different users can easily interfere with each others' edits if they are not careful.

How exactly do I set this up? What do I need? What does my partner need? The details are not stated, but I don't know enough about Emacs to know where to start.

Is there any other way to get a shared Emacs session? This page from the Emacs Wiki refers to something called multi-tty. The questions I asked above also apply to this.

Which is better: multi-tty or make-frame-on-display?

+1  A: 

I haven't tried multi-tty, but make-frame-on-display is pretty simple. You type M-x make-frame-on-display, hit return, then type the display you want the frame to show up on. For example:

I have my local host (thor) running emacs and I want to make a frame pop up on a machine called zeus, on its only X display (0.0). So I would type M-x make-frame-on-display<ret>zeus:0.0<ret>

All set!

You may need to configure the remote machine's X server to accept incoming connections from your machine with "xhost +thor". You may also need to configure its firewall to allow incoming connections on the X11 port, which is 6000. Keep in mind that X forwarding is not encrypted, so if you aren't working with someone on your LAN you may want to go through a VPN in order to keep things private.

Edited to fix brackets.

Nathon
You type `M-x make-frame-on-displayzeus:0.0` into which machine? Must you SSH into thor first?
hekevintran
Starting with an emacs window running on thor, you type M-x make-frame-on-display<ret>zeus:0.0
Nathon
+1  A: 

You can also have the person at zeus type ssh -X thor emacsclient -c.

offby1
A: 

Did you ever consider using GNU screen on a shared account for pair programming? It's dead easy to get it to work and you get to pick any console based editor you and your partner like (emacs, vim, joe, nano, zile, ...). However, this does of course not work with editors that cannot run inside a terminal.

To set it up, create a shared account on a computer running ssh. Then both log in to that account. One of the partners starts screen with

screen

and the other connects to it with

screen -x

where -x means "attach to a not detached screen session". The users can detach from their sessions w/ "C-a d".

Gerald Senarclens de Grancy