2010-11-25 5 views
19

나는 이맥스에서 초보자입니다. 며칠이 지나면 자동 완성을 시도 할 때 오류가 발생합니다. .. 난 설치 작업 (내가 메이크 파일을 사용) http://cx4a.org/software/auto-complete/에서 설치 ...하지만 난 내 emacs.d 내부에이 라인을 넣을 때이맥스에서 자동 완성을 설치하려고하면 오류가 발생합니다.

(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict") 
(require 'auto-complete-config) 
(ac-config-default) 

나는

Warning (initialization): An error occurred while loading `/home/yo/.emacs': 

Symbol's value as variable is void: ac-dictionary-directories 

To ensure normal operation, you should investigate and remove the 
cause of the error in your initialization file. Start Emacs with 
the `--debug-init' option to view a complete error backtrace 

내가 '이 오류를 얻을 내 폴더 .emacs in /home/yo/.emacs이 안에는 ac-dic..inside라는 폴더가있다. C++ mode..lisp mode ruby ​​mode ... etc..etc ... etc. ....

내 autocomplete.el이 내 .emacs에도 있습니다. 내가 뭘 잘못하고 있니? ... 감사합니다!

답변

2

.emacs.은 일반적으로 elisp 파일이고 .emacs.d은 디렉토리입니다. 당신이 다른 방향으로 그들을 대하는 것처럼 보입니다. 당신은 ~/.emacs에서

(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict") 
(require 'auto-complete-config) 
(ac-config-default) 

하지 .emacs.d했습니다.

또는 질문이 명확하지 않습니다. ~/.emacs의 모습은 무엇인가요?

편집 :

은 또는, 당신은

(add-to-list 'load-path "~/.emacs.d/ac-dict") 
(require 'auto-complete-config) 
(ac-config-default) 

대신

(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict") 
(require 'auto-complete-config) 
(ac-config-default) 

내가 /home/yo/.emacs 내 폴더 이맥스를했습니다 싶지 및 이 안에는 폴더 ac-dic..inside이 있습니다. C++ 모드 .. lisp 모드 루비 ​​모드 ... etc ... etc ... .....

~/.emacs은 파일이어야합니다. 디렉토리가 아닙니다.

하지만 난 내 emacs.d 내부에이 라인을 넣을 때

~/.emacs.d/ 디렉토리

4

을해야 나는 문제가 add-to-list 기존 목록 앞에 추가하고 싶어 의심하지만,이 당신이 그것을 부를 때 그와 같은 변수는 없습니다.

당신은 (setq 'ac-dictionary-directories "~/.emacs.d/ac-dict")를 대신 사용하거나에 대한 도움말의 조언을 따를 수있는 추가 기능에 대한 목록 : 사용하고자하는 경우

add-to-list' on a variable that is not defined until a certain package is loaded, you should put the call to 추가로 목록이 실행됩니다 후크 기능으로 ' 패키지를로드 한 후에 만 `eval-after-load '는이를 수행하는 한 가지 방법을 제공합니다. 경우에 따라 주요 모드 후크와 같은 다른 후크가 작업을 수행 할 수 있습니다.같은 즉

뭔가 :

(eval-after-load 'auto-complete-config 
    '(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")) 

또는 마지막으로, 당신은 단지 require 후 변수를 설정할 수 있습니다,하지만 난 그 자동 완성의 초기화와 상호 작용하는 방법을 모르겠어요.

27

ac-dictionary-directories은 auto-complete.el에 정의되어 있으므로 emacs에서는 자동으로 찾지 않습니다. 간단히 문장의 순서를 변경하십시오.

(require 'auto-complete-config) 
(ac-config-default) 
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict") 

이제는 작동합니다.

+1

그냥이 ... 나를 위해 이맥스 24.2.2, 자동 완성 v1이 작동하지 않았 음을 추가 할 내 .emacs.d에 복사 한 후 sources을 다시 다운로드. 3.1. yasnippet에 대한 설정이 전혀 없습니다. – galactica

+0

+1. 또한이 세 줄 위에 (add-to-list 'load-path "~/.emacs.d") 추가해야합니다. – gihanchanuka

0

이 문제가 발생했습니다. 다른 컴퓨터에서 자동 완성 파일을 복사했기 때문입니다. 이를 해결하기 위해, 나는 그것을 다시 컴파일하고 cd auto-complete make byte-compile cp *.el *.elc ~/.emacs.d

관련 문제