Emacs - Error when calling (server-start)

前端 未结 11 914
走了就别回头了
走了就别回头了 2020-11-30 18:04

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 <

相关标签:
11条回答
  • 2020-11-30 18:51

    To avoid hacking in the lisp directory, you can just add the following to your .emacs:

    (require 'server) (and (>= emacs-major-version 23) (defun server-ensure-safe-dir (dir) "Noop" t))

    0 讨论(0)
  • 2020-11-30 18:54

    I enjoy to anwer of larsreed, but complite code ready to use:

    (require 'server)
    (when (and (>= emacs-major-version 23)
               (equal window-system 'w32))
      (defun server-ensure-safe-dir (dir) "Noop" t)) ; Suppress error "directory
                                                     ; ~/.emacs.d/server is unsafe"
                                                     ; on windows.
    (server-start)
    

    I discass this issue in my blog article http://brain-break.blogspot.com/2009/08/when-moving-from-gnu-emacs-22.html

    Also note that in 2009-09-19 fixed bug #4197 about server-ensure-safe-dir so in incoming Emacs 23.2 this workaround is not needed.

    Under recently released Emacs 23.2 I have such warning:

    Warning (server): Using ~/.emacs.d/server to store Emacs-server authentication files. Directories on FAT32 filesystems are NOT secure against tampering. See variable server-auth-dir for details.

    To fix this as say warning you can point server-auth-dir to NTFS partition (%APPDATA% usually located Windows %SYSTEMDRIVE% and user usually format system drive as NTFS partition):

    (require 'server)
    (when (and (eq window-system 'w32) (file-exists-p (getenv "APPDATA")))
      (setq server-auth-dir (concat (getenv "APPDATA") "/.emacs.d/server"))
      (make-directory server-auth-dir)  )
    (server-start)
    
    0 讨论(0)
  • 2020-11-30 18:55

    If it's the server folder ownership issue that RealityMonster identified, then you can run this at the windows command prompt to fix it:

    takeown /f %USERPROFILE%\.emacs.d\server /r /d y
    
    0 讨论(0)
  • 2020-11-30 18:56

    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.

    0 讨论(0)
  • 2020-11-30 18:58

    Did not work for me in Windows 7.

    I instead read the comments in server-ensure-safe-dir and proceeded with taking the ownership for %APPDATA% forlder and subfolders. They were owned by local Administrators, not by me.

    That helped!

    0 讨论(0)
提交回复
热议问题