Emacs-호출시 오류 (서버 시작)
현재 Windows Vista SP1에서 GNU Emacs 23.0.93.1을 사용하고 있습니다. 내 .emacs 파일 에서을 호출하면 The directory ~ / .emacs.d / server is unsafe(server-start)
메시지와 함께 오류가 발생합니다 . 누구든지 이것을보고 수정 또는 해결 방법을 알고 있습니까? ... 서버를 끄는 것 외에는;)
다음은 스택 추적입니다.
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)
EmacsWiki에서이 솔루션을 찾았습니다.
"문제는 계정에 대한"관리자 "권한도있을 때 ~ / .emacs.d / server 디렉토리의 소유권입니다. ~ / .emacs.d / server 디렉토리를 만들고이 디렉토리의 소유자를 로그인으로 설정하십시오. "네덜란드어"버전의 Windows 7을 사용하고 있으므로 영어 용어를 정확히 모르지만 절차는 다음과 같습니다.
~ / .emacs.d / server에서 R-mouse를 클릭하고“Properties”(메뉴의 마지막 항목)를 선택합니다. 속성에서 "보안"탭을 선택한 다음 "고급"버튼을 선택합니다. 그런 다음 "소유자"탭을 선택하고 소유자를에서 Administrators (<your-pc-name>\Administrators)
로 변경하십시오 <your-login-name> (<your-pc-name>\<your-login-name>
. 이제 서버 코드는 사용자가 소유자이므로이 디렉토리를 안전한 것으로 승인합니다.
이것이 여러분 모두에게 도움이되기를 바랍니다. 어쨌든 문제가 해결되었습니다.
WKR Reutefleut "
Emacs 23.2.1과 함께 Vista에서 확실히 작동합니다.
나는 larsreed에 대해 좋아하지만 사용할 준비가 된 complite 코드 :
( '서버 필요) (그리고 (> = emacs-major-version 23) (동일한 윈도우 시스템 'w32)) (defun server-ensure-safe-dir (dir) "Noop"t)); 오류 "디렉토리 표시 안함 ; ~ / .emacs.d / server가 안전하지 않습니다. " ; 창문에. (서버 시작)
내 블로그 기사 http://brain-break.blogspot.com/2009/08/when-moving-from-gnu-emacs-22.html 에서이 문제를 설명합니다.
또한 2009-09-19에서 server-ensure-safe-dir에 대한 버그 # 4197을 수정 했으므로 들어오는 Emacs 23.2에서는이 해결 방법이 필요하지 않습니다.
최근 출시 된 Emacs 23.2에서 다음과 같은 경고가 있습니다.
경고 (서버) : ~/.emacs.d/server
Emacs-server 인증 파일을 저장하는 데 사용 합니다. FAT32 파일 시스템의 디렉토리는 변조로부터 안전하지 않습니다. 자세한 내용은 변수 server-auth-dir
를 참조하십시오.
경고로이 문제를 해결하려면 server-auth-dir을 NTFS 파티션 %APPDATA%
으로 지정할 수 있습니다 ( 일반적으로 Windows에 %SYSTEMDRIVE%
있으며 사용자는 일반적으로 시스템 드라이브를 NTFS 파티션으로 포맷).
( '서버 필요) (및 (eq window-system 'w32) (file-exists-p (getenv "APPDATA"))) (setq server-auth-dir (concat (getenv "APPDATA") "/.emacs.d/server")) (메이크 디렉토리 서버 인증 디렉토리)) (서버 시작)
이것은 Windows에서 알려진 Emacs 버그입니다. 해결 방법은 server.el의 server-ensure-safe-dir에서이 줄을 주석 처리하는 것입니다. 변경 후 바이트 재 컴파일을 원할 것입니다.
;; FIXME: Busted on Windows.
;; (eql (nth 2 attrs) (user-uid))
lisp 디렉토리에서 해킹을 방지하려면 .emacs에 다음을 추가하면됩니다.
(require 'server) (and (>= emacs-major-version 23) (defun server-ensure-safe-dir (dir) "Noop" t))
또한 서버가 배치 모드로 시작되는 것을 원하지 않습니다. 내 .emacs에서 나는 따라서
(defconst --batch-mode
(or noninteractive (member "--batch-mode" command-line-args))
"True when running in batch-mode (--batch-mode command-line switch set).")
그리고
(unless --batch-mode
(require 'server)
(when (and (= emacs-major-version 23)
(= emacs-minor-version 1)
(equal window-system 'w32))
;; Suppress error "directory ~/.emacs.d/server is unsafe" on Windows.
(defun server-ensure-safe-dir (dir) "Noop" t))
(server-start))
Still the server feature is capricious: server-start
throws when the %HOME%/.emacs.d/server directory does not exist. In succession Emacs won't start up again! The obvious solution is to create the missing directory and try again; I found the solution somewhere on the net but really can't remember where. The following code runs successfully for years now on several of my Windows machines:
(unless --batch-mode
(require 'server)
(when (and (= emacs-major-version 23)
(= emacs-minor-version 1)
(equal window-system 'w32))
;; Suppress error "directory ~/.emacs.d/server is unsafe" on Windows.
(defun server-ensure-safe-dir (dir) "Noop" t))
(condition-case nil
(server-start)
(error
(let* ((server-dir (if server-use-tcp server-auth-dir server-socket-dir)))
(when (and server-use-tcp
(not (file-accessible-directory-p server-dir)))
(display-warning
'server (format "Creating %S" server-dir) :warning)
(make-directory server-dir t)
(server-start))))
)
)
This code also works when running Emacs from a stick.
Hope this helps.
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!
Very helpful answer from gavenkoa. I'm having this problem on Emacs 24.1, Windows 2003.
Unfortunately, overriding server-ensure-safe-dir to become a noop, as suggested in your first snippet, didn't work for me in all situations. Specifically, it did not work when applied before (server-start) had executed at least once, because the initial execution would also create the directory, if it doesn't exist. With the noop version, the directory would not be created at all.
The workaround that worked for me in the sense that it eliminated the error message, while still creating the directory properly, was the following code, put before (server-start) in my Emacs initialization file. It puts an advice around server-ensure-safe-dir to ignore any errors raised from there. Doesn't solve the root cause of the problem, but good enough for me.
(defadvice server-ensure-safe-dir (around
my-around-server-ensure-safe-dir
activate)
"Ignores any errors raised from server-ensure-safe-dir"
(ignore-errors ad-do-it))
In case this occasionally hits people, my workstation just went through a "domain migration", which added another permission to every file on the box, then I started getting this error. After I added the expression to dummy out "server-ensure-safe-dir" this stopped failing.
(If you're wondering, the migration will be in 2-3 steps. The first one adds the permission for me in the target domain, then I get moved to the target domain, then they might (I'm not sure about this) remove the permission for the old domain. It's a big company, and many users, so they're doing it in separate steps.)
last time I tried, the "Take ownership" shell extension did the job
Below step works for me: 1. Execute code below as .reg file. Emacs win version will treat any values in registry as Env Var.
[HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs]
"HOME"="C:/<your_emacs_home>"
"EMACS_SERVER_FILE"="C:/<your_emacs_home>/server/main_server"
"ALTERNATE_EDITOR"="C:/<your_emacs_loc>/bin/runemacs.exe"
- Add code below to your .emacs/init.el. The key here should be "server-auth-dir".
(require 'server)
(setq server-auth-dir "~/server") ;;Server file location
(setq server-name "main_server") ;;Server mutex file name
(server-start)
By steps above server mode works for me correctly and perfect.
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
참고URL : https://stackoverflow.com/questions/885793/emacs-error-when-calling-server-start
'developer tip' 카테고리의 다른 글
PHP 스크립트에서 CSV 파일을 만들고 다운로드하는 방법은 무엇입니까? (0) | 2020.10.04 |
---|---|
AppDomain.CurrentDomain.BaseDirectory 또는 System.Environment.CurrentDirectory를 사용해야합니까? (0) | 2020.10.04 |
어떤 C ++ 표준 라이브러리 래퍼 함수를 사용하십니까? (0) | 2020.10.04 |
현재 버전의 ASP.NET MVC를 확인하는 방법은 무엇입니까? (0) | 2020.10.04 |
HTML5에 minlength 유효성 검사 속성이 있습니까? (0) | 2020.10.03 |