Question

I am having difficulties with emacs server closing unexpectedly. I am connecting over SSH with PuTTY from a Windows 7 machine to an ubuntu machine, using xming to handle x11 windows. It seems to be something to do with the way putty closes connections.

I start an emacs server using emacs --daemon. I then connect to it using emacsclient -c. When I close the resulting window, the emacs server stays running, as it should, and I can reconnect using emacsclient -c again. I can then close the putty session, reopen it, and reconnect again. This is all as I expected.

The trouble comes when I close the SSH session without first closing the emacs window. When reconnecting, the emacs server is no longer running. This only happens when the x11 version of emacs is running. If I start emacs in the terminal with emacsclient -c -nw, the emacs server stays running even if I don't exit emacs before closing PuTTY.

I'm not sure what could be causing this, or where to look to trouble-shoot this more.

Was it helpful?

Solution

There is apparently a bug in the Gtk libraries used by the default emacs binary in Ubuntu.

If you use the lucid variant (eg emacs23-lucid) then things do indeed work swimmingly. I connect, drop, reconnect, ... hundreds of times between reboots.

I re-connect either in text mode, or x11 mode, and set up simple aliases for this:

alias emt='TERM=vt100 emacsclient -nw'
alias emx='emacsclient -c'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top