Emacs - Error when calling (server-start)

λ Jonas Gorauskas picture λ Jonas Gorauskas · May 20, 2009 · Viewed 21.3k times · Source

I am currently using GNU Emacs 23.0.93.1 in Windows Vista SP1. In my .emacs file I make a call to (server-start) and that is causing an error with the message The directory ~/.emacs.d/server is unsafe. Has anyone seen this and know a fix or workaround? ... other than leaving server turned off ;)

Here is the stack trace:

Debugger entered--Lisp error: (error "The directory ~/.emacs.d/server is unsafe")
  signal(error ("The directory ~/.emacs.d/server is unsafe"))
  error("The directory %s is unsafe" "~/.emacs.d/server")
  server-ensure-safe-dir("~\\.emacs.d\\server\\")
  server-start(nil)
  call-interactively(server-start t nil)
  execute-extended-command(nil)
  call-interactively(execute-extended-command nil nil)

Answer

RealityMonster picture RealityMonster · May 31, 2010

I found this solution on EmacsWiki:

"The problem is the ownership of the directory ~/.emacs.d/server when you also have “Administrators” rights on your account. Create the directory ~/.emacs.d/server and set the owner of this directory to your login name and the problem is gone. As I have a “Dutch” version of Windows 7 I don’t know the English terms exactly but here’s the procedure:

Click R-mouse on ~/.emacs.d/server and select “Properties” (last item in menu). From Properties select the Tab “Security” and then select the button “Advanced”. Then select the Tab “Owner” and change the owner from Administrators (<your-pc-name>\Administrators) into <your-login-name> (<your-pc-name>\<your-login-name>. Now the server code will accept this directory as secure because you are the owner.

Hope this helps for all you guys, it solved the problem for me anyway.

W.K.R. Reutefleut"

It definitely works on Vista, with Emacs 23.2.1.