开发者

How to use make-frame-on-display and multi-tty in Emacs?

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?


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.


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


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".


Old question, new solution for anyone landed on this page from year 2016.

I set this up in Ubuntu 14.04 and it works perfectly:

Suppose I want to co-edit or demo some cool stuffs on emacs with my colleague Joe on the other end of the world.

  1. Make sure an ssh server with emacs installed at either end. That is, either MyPC or JoePC must be a SSH server and have Emacs installed. From now on, let's say I asked Joe to install SSH server and Emacs on his computer.
  2. Make sure byobu is installed on JoePC. Byobu supports both tmux and screen as backends (I prefer tmux for a more mordern and feature-rich).
  3. I connect to JoePC with ssh remoteuser@joepc. No need for X-forwarding.
  4. Open emacs from byobu-ssh terminal: TERM=xterm-256color && emacsclient --alternate-editor="" -t. One can make an alias for this command. I recommend this long command because it enables both better color support in the terminal and running Emacs in daemon mode. The daemon mode make it fast to close and reopen frames.
  5. Now the magic unfold: Ask Joe to login with the same remoteuser I am loggin in; open the terminal and start byobu if it hasn't for him.
  6. Start hacking or fumbling :-)

Comment:

  • Because the way byobu work. This approach works for any other program inside the byobu terminal.
  • This setup performs much better than Teamviewer or any other GUI remote desktop solutions.
  • Because the connection is through ssh to the remote server directly, it is as secure as the ssh conenction can offer.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜