reddit / emacs

Problem with loading startup file in windows

suprasa · 2022-10-11 13:40
Emacs is trying to load init file from emacs installation location in program files/emacs/bin. As I found, changing files there is tricky. I remember being able to do my config in my user folder. How can I achieve that? Thanks!
tdavey · 2022-10-11 14:52
On Windows, Emacs will by default look in your HOME directory -- usually "C:\\Users\\your-username\\" -- for your init files. Perhaps something has changed the value of the environment variable "HOME".
remillard · 2022-10-11 15:34
It's a little more complicated than that. The default is actually under AppData. OP here's the relevant link for Windows initialization file locations: https://www.gnu.org/software/emacs/manual/html_node/emacs/Windows-HOME.html For what it's worth, I make sure my HOME environment variable is set to c:/users/<username>/ and put my .emacs.d there because I don't like it under AppData.
pyromaggot · 2022-10-11 19:09
You can add an environment variable HOME and point it to %USERPROFILE%, which is your C:/Users/<username> directory.
suprasa · 2022-10-12 22:18
Hey thanks for the reply and sorry for the late reply! I learned only today that emacs checks for 'home' in the env variables. My home was set to '\Users\<username>' so I changed it to 'C:\Users\<username>' and emacs loads my init file in the .emacs.d folder. I looked at the documentation you mention but I didn't really get what was wrong. All it takes is a reddit post to get the right pointer as to what exactly is wrong I suppose! Thanks again!
suprasa · 2022-10-12 22:19
Thanks for the reply! Can't wait to get back to running emacs!
suprasa · 2022-10-12 22:20
Thanks for the reply! The fix worked. I don't know why or how it changed but it was '\Users\<username>' It worked out fine once I added in 'C:'