in emacs · xorg

emacs *ERROR*: Display :0.0 can't be opened

In my .emacs I have:

(setq server-name "vejeta")
(server-start)

So that it always starts an emacs server.

Today on my work machine, a Debian squeeze, I wanted to start emacs graphically.

emacsclient -s vejeta -c

-s vejeta : So that it connects to the «vejeta» server

-c : So that it creates a new frame (or window)

The error mentioned above was produced:

emacs *ERROR*: Display :0.0 can't be opened

 

I solved it by running in the console:

## Dance so screen subprocesses can talk to GDM-spawned X servers.
if test -n "$XAUTHORITY"
then
    xauth extract - $DISPLAY |
    xauth -f ~/.Xauthority merge -
    unset XAUTHORITY
fi

 

Source that helped me solve it: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=539809