Emacs in WSL and opening links

Using Emacs on Windows got a little bit easier with the latest Creator Update to Windows 10. First great improvement allows to run unpatched Emacs and connect it to X Server like an opensource VcXsrv. Copying and pasting between Emacs and Windows apps now works like a charm, and resizing Emacs (gtk) window also works as expected. It become a really pleasant experience and it feels it have better performance than a natively compiled one.

You can symlink your contents of NTFS drives to have them easily accessible inside your WSL’s home directory. And finally you can run Windows binaries from inside WSL which makes using Guillaume Knispel’s cbwin largely obsolete.

To have Emacs open links in your Windows web browser of choice you just need to add to your init.el file the code below:

(let ((cmd-exe "/mnt/c/Windows/System32/cmd.exe")
      (cmd-args '("/c" "start")))
    (when (file-exists-p cmd-exe)
      (setq browse-url-generic-program  cmd-exe
            browse-url-generic-args     cmd-args
            browse-url-browser-function 'browse-url-generic)))


Adam Kruszewski

Software Engineer, Entrepreneur, Open source enthusiast.

location: Bydgoszcz, Poland https://adam.kruszewski.name/