# emacs in WSL2 on my work laptop

*Entered: in emacs on Lenovo Thinkpad P14s (Windows 10/WSL2 Ubuntu)*
*Date: 20231214*

## night before a travel day

I have not a lot going on tonight, finished my paperwork and
decided to screw around with getting GUI emacs working in Windows
10 on my work laptop. I had the Windows Subsystem for Linux
installed on this Thinkpad P14s since the day I got it. It
seemed, however that I had WSL 1 installed. I ran

```
wsl update
```

and upgraded to WSL 2. Previously I was running Ubuntu from the
Microsoft Store. I ran

```
wsl --list --online
```

and got a list of available distibutions. I had emacs 28
installed and the MS Store Ubuntu under WSL 1 had no upgrades for
this. I had previously attempted to pull down the repo from gnu
savanah, but compiling it hung. So I installed Ubuntu-22.04,
copied over my home directory from within Windows from the MS
Store Ubuntu to the 22.04 install. Then

```
sudo snap install emacs
```

*et voila* not only did it install emacs accessible in the
Windows Terminal via

```
emacs -t
# and of course emacsclient -t via my C-e binding in bash
```

I got GUI emacs and even a shortcut to it in the start menu. The
video was garbled at first. I had to download and install a new
AMD Radeon Pro driver, and this was resolved. My env was not
available by default. The elisp I wrote that generates templates
for phlog and gemlog entries uses an environment variable for
machine name, so I wanted to get this to work. So I added

```
bash -ilc
```

in front of

```
emacs
```

in the shortcut command field. This loads emacs from bash and my
environment is thus intact and available. Everything shows as I
expect in eshell, and the template code works as intended. I
plopped my favorite font (Iosevka Nerd Mono) into ~/.font and
emacs looks how I like.

All in all, it makes using my work mandated laptop more homey.
Until rockwell, fanuc, seimens, and all other industrial
automation software vendors decide to release linux versions of
their programs, I don't see my employer moving aways from
Windows. So the WSL is a nice thing to have.