Sunday, January 18, 2009

Carbon emacs, python-mode, tab-width

Carbon emacs tab-width of 8 is too big for me.

Just setting (setq tab-width 4) doesn't work when in python-mode.

I found a good way to change that here.

I had to change the python-indent variable as well to get the desired effect:

(defun my-pystuff ()
(setq tab-width 4
py-indent-offset 4
indent-tabs-mode t
py-smart-indentation nil
python-indent 4))

(add-hook 'python-mode-hook 'my-pystuff)

(Add this to your .emacs)