How can I get WSL [Windows Sub-system for Linux] to run in a window on Windows GUI Emacs?

The only way I can do it so far is to enter a subshell in either emacs shell or term cmd by entering the wsl command, and even then, there is no background ANSI coloring, though the foreground coloring appears to be working.

The following is an attempt at directly spawning a wsl.exe child process.

(if (eq system-type 'windows-nt)

    (setq explicit-shell-file-name "C:\\Windows\\System32\\wsl.exe")

    (defun run-wsl ()
        (let ((shell-file-name "C:\\Windows\\System32\\wsl.exe"))
            (ansi-term "*wsl.exe*")

Error message under mode bar: Spawning child process: Invalid argument

Edit 1:

Note that I am asking how to get WSL in Emacs, not Emacs in WSL.

  • Like this askubuntu.com/questions/993225 – Biswapriyo May 15 at 4:13
  • @Biswapriyo That is Emacs in WSL, not WSL in Emacs. – rzjnzk May 15 at 4:43
  • Does Emacs even have full colour support in the first place? Last time I tried it on Linux, the built-in terminal could only show 8 colors and the background format looked wonky. – grawity May 15 at 6:13
  • @grawity I'm not sure, but more importantly, I don't get any background support, but do get 8-color foreground support. At the very least I would like background support. – rzjnzk May 15 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.