0

wsl Ubuntu cannot connect when using emacsclient to connect to emacs server.

My emacs init.el file settings are

(setq server-socket-dir "~/.emacs.d/server")

and I see the following when trying to start the server and client:

huyu01@huyu01:~/.emacs.d/server$ emacs --daemon
Starting Emacs daemon.
huyu01@huyu01:~/.emacs.d/server$ ls ~/.emacs.d/server
server
huyu01@huyu01:~/.emacs.d/server$ ls -l ~/.emacs.d/server
total 0
srwx------ 1 huyu01 huyu01 0 May  6 17:34 server
huyu01@huyu01:~/.emacs.d/server$ whoami
huyu01
huyu01@huyu01:~/.emacs.d/server$ emacsclient --server-file=~/.emacs.d/server/server -c
emacsclient: error accessing server file "~/.emacs.d/server/server"
huyu01@huyu01:~/.emacs.d/server$ emacsclient --server-file=~/.emacs.d/server/server a
emacsclient: error accessing server file "~/.emacs.d/server/server"
huyu01@huyu01:~/.emacs.d/server$ emacsclient a
emacsclient: can't connect to /mnt/wslg/runtime-dir/emacs/server: Permission denied
emacsclient: No socket or alternate editor.  Please use:

        --socket-name
        --server-file      (or environment variable EMACS_SERVER_FILE)

How can this be solved?

1 Answer 1

2

Two things.

  1. You're using the TCP option --server-name when you should be using --socket-name

  2. ~ probably won't work. Use $HOME or else the absolute path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.