init file - emacs 애정 증폭제

less than 1 minute read

초기화 명령들을 담고 있는 파일을 vim에선 vimrc 라고 부르고 emacs는 init file 이라고 부른다. dotemacs 가 좀 더 간지나지만 메뉴얼에서 init file 이라고 부르니 이 용어를 사용한다.

에디터를 새로 배우면 뭔가 편집하고 싶어서 근질거린다. 평소에는 수정해야 할 문서가 많은데, 왜 에디터를 배우려고 하면 없을까? 그럴 땐 init file을 수정하면서 익히면 된다. 쓰담쓰담 하다 보면 익숙해지고 애정도 생긴다.

~/.emacs ~/_emacs ~/.emacs.d/init.el 이렇게 3가지 옵션이 있다. .emacs.d 폴더에 담는 걸 선호한다. 밖에 흘리지 말고 여기서만 놀아보자.

Windows

c:\> setx HOME %homedrive%%homepath%

emcas는 HOME 환경 변수를 참조한다. ~ 디렉토리가 바로 여기. init file 을 로드하는 기준 디렉토리로 사용한다. windows가 알아서 만드는 환경 변수가 아녀서 만들어야 한다.

c:\> mklink /J %homedrive%%homepath%\.emacs.d %homedrive%%homepath%\.dotfiles\emacs.d

ohyecloudy/dotfiles - github에 올려놓고 관리한다. ~/.dotfiles 에 clone 했으니깐 ~/.emacs.d 디렉토리에서 ~/.dotfiles/emacs.d 에 접근할 수 있게 directory junction을 만들어 준다.

macOS

#!/bin/bash

script_path=...
root_path=...

gcc $root_path/mac/hlink.c -o $root_path/mac/hlink
$root_path/mac/hlink $root_path/emacs.d ~/.emacs.d

mac-bootstrap.sh 참고.

osx(10.7.5)에는 directory junction 기능이 없어서 소스를 컴파일하고 실행해 만든다.

ln -s 프로그램을 그냥 사용하면 된다.

참고

C-x C-s C-x C-c