chenyanming / chenyanming.github.io

Damon Chan's Personal Blog
https://blog.hkvim.com
1 stars 0 forks source link

post/windows-setup/ #1

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

The ultimate Emacs hacking tutorial in Windows 10 WSL 2 | Damon Chan's Blog

Do you think Emacs’s performance in windows is bad? Do you really want to use a native Speed Emacs in Windows? Do you hate the unnatural path transition between windows convention and Linux convention? Do you feel frustrated when you try to install and configure Emacs in WSL?

https://blog.hkvim.com/post/windows-setup/

chenyanming commented 3 years ago

Welcome Comments~

BenedictHW commented 3 years ago

Hi! Thanks for writing this up, it's helped a lot :) I cannot fix the WSL INTEROP issue, I still get the following output when trying to open a windows application from within emacs shell (the same command works fine in the original terminal):

<3>init: (16753) ERROR: UtilConnectToInteropServer:300: connect failed 2

However, I am probably doing something wrong. I have tried the fix by putting the snippet into my .zshrc file

# fix interop
fix_wsl2_interop() {
    for i in $(pstree -np -s $$ | grep -o -E '[0-9]+'); do
        if [[ -e "/run/WSL/${i}_interop" ]]; then
            export WSL_INTEROP=/run/WSL/${i}_interop
        fi
    done
}

but the problem persists. Can you clarify in more detail what you did to solve this? Do I have to call fix_wsl2_interop() manually? I am using spacemacs, if that helps.

Thank you for your time!

Edit: so running the commands manually, one by one, works. I may be missing something very obvious, but when I place it in my ~/.bashrc and call a new buffer/instance of the emacs shell the same INTEROP error shows up

Edit 2: Learned more about bash. For posterity: adding these two lines to your ~/.bashrc fixes things up for you.

export -f fix_wsl2_interop
fix_wsl2_interop

Forgive me, my field of training isn't in the computer sciences. For other who are new to spacemacs/bash like me, you must export the function before calling it, thats all.

farra commented 3 years ago

Best write up on this setup I've seen so far. Thanks!

DanEdens commented 3 years ago

I'd been working on this for hours until I saw this about exporting the function.. Thanks! This issue plagued me using pm2 to init my mqtt-msg-xargs-*.exe pipeline. Works like a charm now. Cheers