help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detachable shells in Emacs?


From: Neil T . Dantam
Subject: Re: Detachable shells in Emacs?
Date: Fri, 07 Sep 2012 22:08:15 -0400
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/23.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

> I work from home occasionally, and so I'd like to be able to leave
> Emacs running at the office and resume working on it remotely, on my
> laptop, over an ssh tunnel.  But when I try to create a frame on my
> laptop's display, using "localhost:10.0" as the display, I get "X11
> connection rejected because of wrong authentication."

Likely, the XAUTHORITY used by emacs does not know how to talk to the
X connection forward by ssh.  I've had this problem when GDM makes
some random XAUTHORITY file under /var, which emacs will also use,
while SSH puts everything in ~/.Xauthority.  The following script is
what I use to forward emacs frames through SSH:

    #!/bin/sh

    #### Create a new emacs frame on $DISPLAY, setting xauthority properly

    ### Merge the xauth entry for $DISPLAY into emacs's xauthority
    # scrub out localhost from display, or xauth doesn't list it
    SCRUBBED_DISPLAY=`echo $DISPLAY | sed -e 's/^localhost:/:/'`
    if [ -n "$SCRUBBED_DISPLAY" ]; then
        CURRENT_XAUTH=`xauth list $SCRUBBED_DISPLAY`
        emacsclient -e "(shell-command \"xauth add $CURRENT_XAUTH\")" > 
/dev/null
    fi

    ### New emacs frame
    exec emacsclient -e "(make-frame-on-display  \"$DISPLAY\")"


-ntd





reply via email to

[Prev in Thread] Current Thread [Next in Thread]