I run Emacs on development host under X Window as:

$ emacs24

with ~/.emacs:

(require 'server)

Next when I connect to Emacs as:

$ ssh -Y localhost
ssh$ emacsclient -c
C-x C-c
ssh$ exit

or as:

$ startx xterm -- `command -v Xnest` :1 -geometry 800x600
xnest$ emacsclient -c
C-x C-c
xnest$ exit

main Emacs exit.

I like ability to join to my Emacs session from remote host for getting working context immediately. But when I come to original host or try to re-establish X connection - I have to start new Emacs.

How to make Emacs live when I close remote X connection?

UPDATE I don't try --daemonas think that (server-start) are equivalent form.

2 Answers 2


I submitted a bug and got response that this is known bug of GTK since 2002. See etc/PROBLEMS:

** When Emacs is compiled with Gtk+, closing a display kills Emacs.

As temporary solution - it is recommended to use Lucid Emacs build:

$ sudo apt-get install emacs-lucid

You can use a virtual display solution, such as xpra, to retain the X display session of emacs even after disconnecting from the remote server. Then, if you set DISPLAY environment to the virtual display of xpra when you create the emacs server instance it would keep your emacs session alive across network disconnections as if you are using a local display in the server.

See more details about xpra at: http://xpra.org/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.