reddit / emacs

Daemon in WSL2

Dppdppd · 2022-09-01 14:47
Is there a trick to getting the emacs daemon running in WSL2? It launches fine, but emacsclient can’t find the socket and doesn’t think a server is running. If I set EMACS_SERVER_FILE the socket file isn’t created and (obv) emacsclient can’t find it. I have no such issues doing the exact same thing on windows with the same CFGs.
hangingpawns · 2022-09-01 15:40
How are you launching emacsclient
TheSnowIsCold-46 · 2022-09-01 16:10
Agree, understanding how you are launching emacsclient would be helpful. I can run emacs in WSL2 and use VcXsrv to have gui on Windows host using the daemon running as bg and using **emacsclient -nc** to get started. I did not have to set the EMACS\_SERVER\_FILE. Also works if I dont use VcXsrv, so curious how you are launching the daemon, and then subsequently how you are trying to launch the client
blimbu1 · 2022-09-01 20:28
I use the same setup. How do you prevent emacs gui from crashing during screen lock/sleep when using with wsl2. I use wsld but not sure if that is totally preventing it from crashing(I think it has become much better though)
TheSnowIsCold-46 · 2022-09-01 23:45
I don't think I've had it crash on screen lock, but definitely on sleep. I'll have to look to see what happens on wake.
Dppdppd · 2022-09-02 04:45
$ emacsclient -nw "" emacsclient: can't find socket; have you started the server? emacsclient: To start the server in Emacs, type "M-x server-start". emacsclient: No socket or alternate editor. Please use: --socket-name --server-file (or environment variable EMACS_SERVER_FILE) --alternate-editor (or environment variable ALTERNATE_EDITOR) '''
Dppdppd · 2022-09-02 04:47
https://old.reddit.com/r/emacs/comments/x39j0r/daemon_in_wsl2/imrbeps/
hangingpawns · 2022-09-02 05:17
That's the problem emacsclient -nw -c
DryNick · 2022-09-02 08:51
I added these aliases in my .zshrc: alias emacsd="emacs --daemon &" alias e="emacsclient -t --socket-name=/tmp/emacs1000/server" To run: `emacsd` and then `e`
DryNick · 2022-09-02 08:52
I am very new to emacs so maybe I don't understand your question. But this works well for me in WSL2.