[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to *properly* set up Emacs on Windows?

From: Joost
Subject: Re: How to *properly* set up Emacs on Windows?
Date: Wed, 09 Feb 2022 09:48:09 +0100
User-agent: Cyrus-JMAP/3.5.0-alpha0-4748-g31a5b5f50e-fm-cal2020-20220204.001-g31a5b5f5

Hi Óscar,

Thanks for your elaborate answer. It clears up some questions, but 
unfortunately also raises a few:

On Tue, 8 Feb 2022, at 21:02, Óscar Fuentes wrote:
>> I can set `package-gnupghome-dir` to
>> "/c/Users/joost.kremers/.emacs.d/elpa/gnupg" and that will fix this
>> issue, but it doesn't feel like it's the right solution.
> Why do you need to set package-gnupghome-dir at all?

I didn't set the original value with the Windows-style path, that was done 
automatically. I tried the POSIX-style path just to see if it worked. (There's 
a StackExchange answer somewhere suggesting this, but I posted here because I 
didn't think this was the right way to go about it.)

>> I *think* it happened when I tried to use some external utilities from
>> within Emacs, mainly git and diff, for which I modified my PATH
>> variable.
> First of all, undo those changes to PATH and any other change to .emacs
> related to Windows support.

I had C:/msys64/usr/bin in my system PATH and replaced it with 
C:/msys64/mingw64/bin. The only other change I made was to add C:/Program 
Files/Git/usr/bin to `exec-path` in Emacs, in order to use git from 

> MSYS2 provides many utilities as MinGW packages.
> For instance, if you installed emacs with:
> $ pacman -S mingw-w64-x86_64-emacs

I didn't, I installed Emacs from (installed to C:/Program\
Files/emacs-27.2-x86_64/). Would there be an advantage in installing Emacs with
pacman instead? Will that give me a graphical Emacs or just a console one?

> you should install those utilities as:
> $ pacman -S mingw-w64-x86_64-grep
> $ pacman -S mingw-w64-x86_64-diffutils
> $ pacman -S mingw-w64-x86_64-ag

Any point in installing those given that I didn't install Emacs with pacman? 
Can they be used with Emacs from

> For communicating with ELPA:
> $ pacman -S mingw-w64-x86_64-gnupg

Currently, after modifying the system PATH as described above, I can install 
packages from GNU Elpa again (Melpa was never a problem).

> For nativecomp support:
> $ pacman -S mingw-w64-x86_64-libgccjit

Is there an Emacs 28 pretest available that will work with this? (The Windows 
binaries that were anounced on emacs-devel the other day appear to be MSYS2 
binaries? And `pacman -Ss emacs` doesn't return any Emacs 28 packages.)

> MSYS2 does not provide git as a MinGW package, so you have two options:
> either install the MSYS2 package (pacman -S git) or install "Git for
> Windows", which provide an almost native port.

I'm using the latter and added "C:/Program Files/Git/usr/bin" to `exec-path`, 
as mentioned above. Wrong decision?

> If you are a Magit user, you can also set magit-git-executable.

OK, I can try that instead.

> Now, a very important detail. Emacs does not follow the Windows
> convention of searching executables from the current process' directory.
> This means that you must explicitly tell Emacs where to look for all
> those utilities. You can add c:\msys64\mingw64\bin (change it if you
> installed MSYS2 elsewhere) to PATH or set PATH directly within Emacs:

I've now added that directory to the system PATH.

> You shouldn't need further modifications to your .emacs or to the
> environment (*), so ask here before adding something else.

I've been using Git Bash (alongside eshell) as my shell of choice. Would the 
MinGW-x64 shell provided by MSYS2 be a better choice? Or doesn't it really 



Joost Kremers
Life has its moments

reply via email to

[Prev in Thread] Current Thread [Next in Thread]