python-indent-offset 기본값

2017. 7. 27. 14:21

c언어의 경우 아래와 같이 기본 들여쓰기값을 설정할 수 있습니다.


(setq-default indent-tabs-mode nil)

(setq-default tab-width 2)

(defvaralias 'c-basic-offset 'tab-width)


하지만 파이썬의경우 소스파일을 열면 들여쓰기 값을 guess하기때문에 단순히 변경하기가 어렵습니다.


이 때, python.el파일을 수정해서 사용하는 방법이 있습니다.


/usr/share/emacs/25.1/lisp/progmodes/python.el.gz에서


(defcustom python-indent-offset 4 를 찾아서 2로 바꾸어줍니다


이 때, python.elc가 존재하여 변경사항이 적용되지 않는경우가 있습니다. python.el을 연 후 X-x byte-compile-file을 이용하여 python.elc를 새로 만들어 주면 됩니다.

emacs/for Python