emacs의 cusom-file이 여러개일때..

lazycoder의 이미지

현재 설정은 이렇습니다.

(setq custom-file "~/.emacs.custom.el")

그런데 내용을 쪼개서 파일을 두개로 만들었는데
.emacs에서 이 두 파일을 custom-file로 지정하려면 어떻게 하지요?

cinsk의 이미지

혹시 init file과 custome file을 혼동하는게 아닌가 의심되는데요. custome file을 왜 두 개로 나누는 지 모르겠네요. 아뭏든 초기에 (load ...)를 쓰면 읽어올 수 있긴 합니다.

(setq custom-file "~/.emacs-custom.el")
(load custom-file)

--
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
Korean Ver: http://www.cinsk.org/cfaqs/

lazycoder의 이미지

custom file의 내용이 장소와 PC에 따라 달라서 (집, 회사) 내용을 분리하여 쓰려고 했습니다.

;; .emacs
 
;; 회사는 집 커스텀 파일을 포함하는 관계
(setq custom-file "~/.emacs.custom.com.el")
(setq custom-file "~/.emacs.custom.home.el")
 
...

위 처럼 되길 원하는데.. 안되는건가요?

cinsk의 이미지

(setq ..)를 두번 쓰면 당연히 마지막 (setq ...)가 앞을 덮어쓰게 됩니다.

차라리 (if ...)를 써서 집과 회사를 구분한 다음에 (setq ..)가 되도록 하면 될 것 같네요.

(if ...at.home...
   (setq custom-file "~/.emacs.custom.home.el")
   (setq custom-file "~/.emacs.custom.el"))

--
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
Korean Ver: http://www.cinsk.org/cfaqs/

lazycoder의 이미지

cinsk님 답변보고 나름 설정을 유연하게 해봤습니다.

(setq myloc (getenv "HOME"))
(if (equal myloc "c:\\HOME")
	(setq custom-file "~/_emacs.custom.home.el")
  (setq custom-file "~/_emacs.custom.el"))

if문에 조건문을 뭘로 할지 몰라서 이렇게 만들었습니다. 일단 오류는 없으니.. -_-;