I'd like to use emacsclient on my laptop to connect to an emacs server on my desktop.
I think I know that the emacs server process listens to a unix socket in "/tmp/emacs${UID}".
So I need to make a connection between a unix socket in laptop:/tmp/emacs${UID}/socat to desktop:/tmp/emacs${UID}/server.
I can make a socket locally with socat. I have tested:
socat -v UNIX-LISTEN:/tmp/emacs${UID}/socat UNIX-CONNECT/tmp/emacs${UID}/server
emacsclient -nw -s socat .
That works.
So now I need to connect socat to server on the remote host...
desktop:
socat -v TCP-LISTEN:7777 UNIX-CONNECT:/tmp/emacs${UID}/server
laptop:
socat -v UNIX-LISTEN:/tmp/emacs${UID}/socat TCP-CONNECT:127.0.0.1:9999
ssh -L9999:127.0.0.1:7777 desktop
emacsclient -nw -s socat .
I can successfully route traffic over this setup. I know this because my home directory is different on my laptop, and the socat on the desktop is dumping out laptop-home-directory-related paths.
However, the emacsclient process on my laptop doesn't draw a frame.
Is there a way to make this work?
Edit: xuchunyang writes:
By the way, we don't need emacsclient to use the Emacs server, echo '-
eval emacs-version' | nc -U /path/to/emacs/socket works as well.
I can confirm that connecting to the socket on the laptop works:
laptop $ echo '-eval emacs-version' | nc -U /tmp/emacs248200/socat
-emacs-pid 184752
-print "26.3"
$
tramp
to access stuff on your desktop?echo '-eval emacs-version' | nc -U /path/to/emacs/socket
works as well.