Published 2024-11-27
tag(s): #overblown-minor-annoyances #emacs
The title should more accurately be "don't be so quick to recommend WSL for Emacs users on
Windows, ask some questions first!".
I think this is somewhat specific to the Emacs subreddit, but I don't participate in other
Emacs-related forums.
Every single time someone says "I use Windows and..." doesn't matter what comes next, there will be a highly upvoted answer about how WSL is gonna solve all the problems. I replied a few times explaining why this is not necessarily true, but I figure an advantage of having a site is that I can write something longer and start linking to it :)
If someone is a new Emacs user, before recommended WSL we must first know how familiar they
are with Linux.
This should be obvious, but: dealing with learning Linux, and whatever peculiarities WSL adds
on top of Linux, and also learning Emacs, is a very tall mountain to climb.
Are there some features of Emacs that don't work in Windows? Yes, but the problems can be
circumvented in most cases.
Most Windows users are not as heavy users of the terminal, so unless you know the person
asking for help is one, it won't matter. There's also eshell
, and the
regular shell
that work just fine.
These can be circumvented by installing alternatives via scoop, Chocolatey, using the versions that come with Git, or just downloading the executables from the amazing ezwinports project, and a little configuration:
(setq grep-program (expand-file-name "c:/pathto/grep.exe")
find-program (expand-file-name "c:/pathto/find.exe"))
I will add other more notes here, in future updates to this post :)
Generally speaking, most users won't have administrative access, and won't be able to install
or use WSL anyway. Ask first if that's an option.
Even when they do, usually some (horrible) proprietary tool might keep them tied to Windows
anyway. Or they need to access company resources that are in a shared drive, SharePoint
site[1], etc.
This is the one that doesn't have a proper fix. Magit will be much slower in Windows than Linux. You can just endure it, or try Emacs' built-in vc-mode for a very nice subset of Magit's features. I did the latter, eventually, and wrote an basic tutorial too.
Lately I've been experimenting with using the Emacs server and editing commit messages and rebasing on Windows:
(server-start)
;; for git rebase, it is different than the Linux command
(setenv "GIT_EDITOR" (expand-file-name "~/emacs/bin/emacsclientw.exe -r"))
(defun hoagie-vc-git-interactive-rebase ()
"Do an interactive rebase against another branch.
This command needs the Emacs server running and GIT_EDITOR properly set,
on Windows. And I need to test it on Linux =P"
(interactive)
(vc-git-command "*git rebase -i*" 'async nil "rebase" "-i"
(completing-read "Rebase target: "
(cdr (vc-git-branches)))))
(This reminded me I need to test this command on Linux...)
The way people recommended using WSL feels strangely cultish to me. If I had a received that
advice back in 2016, I wouldn't be an Emacs user right now.
The environment in which I was then was extremely locked down. Just running Emacs,
without installing anything, raised a few eyebrows. Yet I was able to be
productive[2], and it started me down the path of caring about free
software.
Maybe that's why I feel it is always worth it to make Windows users feel welcomed and help them overcome any challenges in their setups. I was in their shoes no that long ago. Or, very recently in Emacs years :)