Reputation: 85
I have a desktop always running at work with Emacs open. I'd like to remotely connect to the process on my computer at work, and am able to do that with ssh and emacsclient. But I can't cleanly exit without causing the original process to crash. I'm doing the following to connect to an emacs frame with a server name of 'foo':
$ ssh -XC ej@tower
$ emacsclient -s foo -e "(make-frame-on-display \"$DISPLAY\")"
This works, however I can't find any way to kill the ssh connection without crashing the original process. It seems like some background process is still connected, and killing it (which occurs after killing the remote connection) brings down everything. Does anyone know a better way to do this or a way ?
Upvotes: 1
Views: 2737
Reputation: 85
The issue I was running into stemmed from a Gtk+ bug which caused Emacs to crash when an X11 connection was unexpectedly lost.
Recompiling to use a different X toolkit solved the issue.
./configure --with-x-toolkit=lucid
Upvotes: 2
Reputation: 73256
I know what you're talking about, and rather curiously I can't recreate it on my current system. I'm not sure why that is. However...
The classic workaround to avoid this is to start processes in a sub-shell:
$ (emacs &)
rather than:
$ emacs &
There are also things like nohup
and disown
which you may or may not have available, but the sub-shell approach is simple and has always been reliable for me.
You could also start the processes from the local side of the connection:
$ ssh -XC ej@tower -f emacs --daemon=foo
$ ssh -XC ej@tower -f emacsclient -s foo -c
Upvotes: 2