Skip to main content
Don't quote your lambdas!
Source Link
Stefan
  • 26.7k
  • 3
  • 52
  • 88

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))))

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))))

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))))
Add a second solution
Source Link
Kyle Meyer
  • 7.2k
  • 28
  • 22

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))))

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)

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))))
Source Link
Kyle Meyer
  • 7.2k
  • 28
  • 22

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)