Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emacs trips over make-directory: File exists: c:/Users/USER/My Documents/.emacs.d/

Tags:

emacs

I try to install/run emacs on a Win7 64-bit machine after using it for years on a WinXP 32-bit machine and run into a problem I do not find any help for in the documentation or on the web.

Symptom:

  1. when starting runemacs.exe for the first time it creates the file *C:\Users\USER\My Documents.emacs.d* as one would expect (for my administrator as well as for my user account) and comes up operational
  2. from the second start of runemacs.exe it breaks in the startup phase, displaying the scratch buffer, ringing the warning bell and displaying in bottom line the error: File exists: c:/Users/USER/My Documents/.emacs.d/
  3. buffer messages specifies: make-directory: File exists: c:/Users/USER/My Documents/.emacs.d/
  4. if runemacs was called with a file to open, i.e. because the file type was associated with it and the file was opened to edit, the file is not open and ready to be edited, but a file can be opened via the menu File->Open File...
  5. but my configurations in the file C:\Users\USER\My Documents.emacs are not loaded

My goal:

I want to regain the way I used emacs on the old WinXP 32-bit system: click a file associated with emacs, get it opened and ready for editing, get my configurations in .emacs loaded automatically, i.e. work with emacs seamlessly.

Checks done and failed attempts to fix this:

  1. I tried the following newly downloded versions of emacs
    • emacs-23.4-bin-i386.zip
    • emacs-23.2-bin-i386.zip (the one I used on the WinXP)
  2. I had the emacs directory containing the directory stucture (bin, etc, ...) located at:
    • C:\Program Files (x86)\emacs-23.4\ (my preferred location)
    • C:\Emacs\emacs-23.4\
    • in the download directory, where I originally extracted it
  3. My HOME variable points to:
    • C:\Users\USER\My Documents (default)
    • C:\Users\USER\My Documents\ (tried)
  4. My PATH variable contains:
    • C:\Program Files (x86)\emacs-23.4\bin (default)
    • or the corresponding other locations which I tried
  5. The ownership and permissions of my C:\Users\USER\My Documents.emacs.d look OK:
    • owner is the USER (administrator or standard_user)
    • permissions grant Full Control
  6. Having originally installed emacs to *C:\Program Files (x86)\emacs-23.4* using the administrator account, I also tried to use user account installation instead (to check for some non- obvious parameter/access permission not set right if the admin account is uses for setup)
  7. For the runemacs.exe executable I manually set the compatibility settings to
    • Windows XP (Service Pack 3)
    • default setting after unpacking: no compatibility setting enabled
  8. I removed the private configuration file C:\Users\USER\My Documents.emacs (inherited from my XP installation) to check whether it produces a screw-up

All that did not change a bit of the described symptom, i.e. either I screwed up in testing the above and missed a particular setting which should work, or I am looking into the wrong direction...

It is still unclear to me whether this has anything to do with:

  • W7 64-bit vs. XP 32-bit
  • environmental parameter screw-up
  • emacs configuration (.emacs, .emacs.d) screw-up
  • general stupidity (of me ;-)

... and why is it has emacs a problem with it in the first place, that the .emacs.d directory already exists... That should be the standard case...

Any help and wisdom much appreciated.

like image 788
user1263845 Avatar asked Mar 12 '12 12:03

user1263845


2 Answers

First of all, nice question. The details and listing of what you've already tried is helpful.

Some points:

  1. Don't have spaces in key paths (Emacs, and %HOME%). Generally, things work fine. But when things break it's often hard to debug and trace back to the fact that some package author didn't take spaces properly into account.

  2. Set a HOME environment variable to your %USER_PROFILE%. Make it %USER_PROFILE%/home if you must, but I use the former.

  3. Start by running emacs without any customization.

    runemacs -Q
    

    When that works, add your customizations one at a time.

like image 86
event_jr Avatar answered Nov 20 '22 13:11

event_jr


n.b. This answer is not relevant to the original question (which was about Windows), but may be useful to Unix users searching for this error message

You will get this error also if emacs does not have the correct permissions on the .emacs.d directory.

Check it

ls -ld $HOME/.emacs.d

And make sure the user you are running under has rwx permissions!

like image 26
Bret Weinraub Avatar answered Nov 20 '22 12:11

Bret Weinraub