Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Emacs Remotely between several machines

I use Emacs remotely using X-Server in a Windows client and Linux server. I noticed that I can halt it using ctrl-z and then type fg 1 to get it working again. Is there some way that I could get it to halt on the machine that I am on, and then log into a different machine and start where I left off? When I start a new ssh session, the emacs job isn't associated to my terminal. There must be someway to "steal" it.

Also, maybe there's an Emacs feature that will do basically the same thing. However, I think closing and re-opening all my files and buffers would take quite a while.

like image 580
User1 Avatar asked Feb 25 '10 00:02

User1


2 Answers

Expanding on the idea of using emacsclient, you can look at what what someone did to solve the problem of editing a file from a different machine than where (s)he started running Emacs.

As of Emacs 23, you can run emacsclient in terminal windows using the -nw option.

Other solutions you might want to try are to use:

  1. gnu screen
  2. vnc

For years I used screen to "attach" and "detach" from a virtual terminal that sounds like your usage model. If you have the ability to use graphics... vnc is really great, just do your work in a vnc session and connect to it any machine.

And your last idea is already implemented by the package desktop (which is bundled with Emacs). Take a look at the wiki page for session management, which includes other alternatives to desktop, as well as add-ons for desktop to lazily load files.

like image 60
Trey Jackson Avatar answered Oct 03 '22 08:10

Trey Jackson


You can run emacs as a server, and use emacsclient to connect to it. You can open multiple connections to the same emacs server, via ttys or X11.

When doing this, C-X C-C will close your connection, and leave the server running.

A simple way to do this by invoking emacs as follows. This will connect to the server if one is running, or create one.

emacsclient --alternate-editor="" -c
like image 45
Lachlan Roche Avatar answered Oct 03 '22 06:10

Lachlan Roche