I am running emacs in daemon mode and I got dissconnected from the server on which it was running. After re-connect, when I run
emacsclient -nc
I get the error
connect localhost port 6012: Connection refused
ERROR: Display localhost:12.0 can't be opened
The daemon still seems to be running, but I can't figure out how to connect to it, any suggestions?
Other fun facts, which may or may not be relevant:
I am connected through a screen session to a head node and then to another side node of a server.
I have been running this setup for a few days and usually I am able to re-connect without problem.
I'm sure I could just restart the daemon but I'd like to recover the working session as it is connected to a running matlab job, which I am interfacing with through matlab-emacs.
Edit: I tried Gilles suggestion and am still running into problems
echo $DISPLAY
returns
localhost:18.0
I went go into the screen session and ran
export DISPLAY=localhost:18.0
and even ran echo $DISPLAY again inside of the screen session
localhost:18.0
Now emacsclient -nc returns
ERROR: Display localhost: 18.0 can't be opened
which is now the same display being used in the machine running the screen session, but still there is no connection.
Note that I tried also with
export display=localhost:18
edit2: A note about my system architecture My laptop, in my office is connected via ssh to a server 'host1'. host1 has a number of node computers. I first create, or log into a screen session
screen -S ohnoplus-five
and then connect to node005 with
ssh node005
I then detach from screen without logging out of node005 and re attach with
screen -r ohnoplus-five
from host1
In response to Gills suggestions, I have run export DISPLAY=localhost18.0 which is the the display returned by echo $DISPLAY on host1, not my local laptop.
emacsclient -c
work outside the screen session? Is the environment variableXAUTHORITY
set in or outside the screen session?