I'm running a TCP server locally, and I'm trying to open a file from a remote host on my local Emacs through emacsclient. The reason for this is that I have emacspeak running locally which gives me speech, and I want to use this for commands that use the $EDITOR
variable, like editing crontab, or kubectl edit
and so on.
This question already exists on StackOverflow and has an answer, but at the time the question was asked, this feature was not yet introduced. This feature is introduced in Emacs 26.0.50, according to the relevant issue.
So, here is what I've set:
server-auth-key
is set to a key I generated withserver-generate-key
server-host
is set to my local computer's hostnameserver-port
is set to 1990server-use-tcp
is set tot
I copied and pasted the local ~/.emacs.d/server/server
into the remote host's ~/.emacs.d/server/server
, and then ran the following command:
$ emacsclient -f server test
This gave me the following output:
emacsclient: connected to remote socket at 10.156.54.246
And then nothing. Nothing pops up on my local Emacs.
Running the same command locally works.
I investigated further and doing a telnet to the host mentioned in the output of emacsclient
on port 1990
doesn't work either.
It looks like I'm not setting the value of server-host
correctly. I've set it to my hostname, but that doesn't seem to be working.
How should I set my server-host
? What should I set it to?
M-x trace-function RET server-execute RET
to try and start investigating what the local Emacs does. Note that you're probably going to have to add some code somewhere becauseemacsclient
will provide names of files that are on the remote machine and which your local Emacs will hence need to access over Tramp. E.g. you may need to set$EDITOR
to a script that doesemacsclient -f server "/ssh:my.remote.host:$1"
.--tramp
option which seems to be introduced in Emacs 26.0.50. I'll try this and let you know.