Once you’ve finished, you can close the X server and use Emacs from a normal WSL console. emacs.d to fit your needs and install any package you need. You can find Emacs in Applications → Development:Īt this point, you can edit. Use XLaunch to start an X server (see my previous article). If you try to list, M-x list-packages, or install packages directly from the WSL console, you will hit the bug I’ve mentioned at the beginning of this article. I assume that you want to install at least a few packages in Emacs to make your life easier. Emacs will work just fine for normal text editing from the WSL console: 1 emacs -nw If you are satisfied with the default Emacs configuration, this is all you need to do. We can install Emacs 25.2, which is the current stable release, with: 1 sudo add-apt-repository ppa:kelleyk/emacs 2 sudo apt update 3 sudo apt install emacs25 Start WSL (use the Bash on Ubuntu on Windows console or write bash in a Command Prompt window) and write: 1 sudo apt update 2 sudo apt upgradeĪt the time of this writing, WSL uses Ubuntu 16.04 which has Emacs 24 in his repositories. Let’s make sure that you have an up to date system. If not, you can check my previous articles Install WSL - Windows Subsystem for Linux and Using the Windows Subsystem for Linux with Xfce 4. I assume that you have a working WSL and a desktop environment, like Xfce, on your Windows 10 machine. For normal editing, you can use Emacs from the WSL console. The idea is to use the GUI version of Emacs when you need to install a package.
As far as I know, Emacs under WSL seems to work without a problem only if you install a desktop environment like Xfce 4. From a practical point of view, this makes Emacs, under WSL, useless if you need to install any package that is not built in.įortunately, there is a workaround for the above bug and I will show you in this post how to avoid the problem. But, when you try to install a new package directly from Emacs, the program is stopped and sent to background and doesn’t seem to be able to cleanly recover when you use fg. At the time of this writing, Emacs works fine for normal text editing. Turns out that the situation is a bit more complex. According to the WSL documentation, Emacs, Vim and other Linux applications that run from console should work just fine. Recently, a reader of this blog asked me about using Emacs under Windows Subsystem for Linux. Solarian Programmer My programming ramblings Home Archives Contact Privacy Emacs 25 on Windows Subsystem for Linux Posted on by Paul