This is caused by electric-indent-mode
, which is enabled by default in
Emacs 24.4. You can turn it off with
(electric-indent-mode -1)
If you don't want to disable electric indent mode entirely but want to
stop the colon from activating electric indent mode in Python mode, then
you could remove the colon character from electric-indent-chars
, which
Python mode gives a local value.
(add-hook 'python-mode-hook
'(lambda ()
(setq electric-indent-chars (delq ?: electric-indent-chars))))