I already checked around the stack exchange and internet for a while to why this issue is occurring, but I can't seem to find the solution.

Whenever I try to enable a disabled command in Emacs, it tells me the following:

Saving file c:/.emacs...
basic-save-buffer-2: Opening output file: Permission denied, c:/.emacs

I have no clue how to fix it because I thought that Emacs only loads it's .emacs on startup or when told to refresh and it wouldn't cause an issue.

Any help is extremely appreciated.


Does this happen when you start Emacs using emacs -Q (no init file)?

It looks like you do not have permission to save your init file at the top of the C:\ drive (which is likely a good thing). (In the old days, the top of the C:\ drive was considered your home directory. Nowadays, that's kind of frowned upon.)

When in Emacs, use C-h r g init file to go to the Init File page. There you will see where you can put your init file.

The first thing you should do, on MS Windows, is to define your HOME folder, which you do by defining the system (aka environment) variable HOME. Then save your init file in that folder.

If your HOME variable is not already defined, or if you want to change your home-folder location, go to Control Panel > System > Advanced system settings > Environment Variables. Click New (if it is not yet defined) or Edit (if it is defined) and enter HOME as the Variable name and the location of the folder you want as the Variable value. Save your changes.

As the manual tells you, you can save your init file (in your HOME folder) in any of a few names:

Emacs looks for your init file using the filenames ~/.emacs, ~/.emacs.el, or ~/.emacs.d/init.el; you can choose to use any one of these three names. Here, ~/ stands for your home directory.


So the answer is very similar to Drew's but you need to keep in mind that whatever you set your HOME variable to one that you have permission of, such as C:/Users/Your User/home/ so that emacs will be able to write to it, at least if you are setting it per user. That should fix it completely

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.