I've been trying to get emacs to let me open a local frame to an already-running emacs for a while now, and I can't seem to make it work. This is with emacs 23.
I start emacs --daemon on my desktop machine, then on my laptop, I run ssh -X <desktop> -f emacsclient -c. I get the following response:
"X11 connection rejected because of wrong authentication
*ERROR*: Display localhost:10.0 can't be opened"
I don't claim to be an expert in xauth, but I've never had any trouble with running ssh -X on these machines.
ssh -X <desktop> -f emacs works fine ssh <desktop> -f emacsclient -t works fine ssh -X <desktop> -f emacsclient --eval '"(make-frame-on-display \"$DISPLAY"\)"' gives the same rejection as emacsclient -c
In terms of X and, what are these commands doing differently? Is the $DISPLAY that emacs --daemon is started in somehow causing the remote access to fail?
Any ideas? I've done a bit of Googling and I can't seem to find a good answer. Any thoughts here?
jason wrote: > Any ideas? I've done a bit of Googling and I can't seem to find a good > answer. Any thoughts here?
ssh manages xauth, injecting a token for the proxied X11 connection (try ssh -X to a shell somewhere, then do an "xauth list"). I would guess the persistent emacs doesn't have the new token, due to using an old version of the xauth database or a different xauth database. Or something. Usually, the xauth database is in ~/.Xauthority so everything ends up sharing it, but it is certainly possible for different sessions to wind up with different ones.
Anyway, hairy, and the right thing to do might be for emacsclient/emacs to handle this transparently, but right now you could maybe try blindly adding any available tokens to whatever xauth database the persistent emacs daemon thinks it's using.