emacs-prelude/doc/modules/python.md
Manoel Vilela 7226716739
Add prelude-python-mode-set-encoding-automatically defcustom (#1293)
- if it is nil (default) does nothing
- if non-nil insert '# coding: utf-8' on top of python buffers
2020-10-07 10:21:20 +03:00

1.3 KiB

Prelude Python

!!! Note

This module builds on top of the shared [Programming](programming.md) module.

Python Mode

Emacs comes with Python programming support through the built-in python-mode. Whenever you are editing Python code run C-h m to look at the Python mode key bindings. Alternatively look at the menu bar entries under Python. To toggle the menu bar press F12.

Syntax checking

Prelude ships with Flycheck, an on the fly syntax checker. Flycheck has support for two Python syntax checkers, Pylint and Flake8. In order to have Flycheck support on the fly syntax checking for Python you need to have either of these installed and accessible to Emacs. In order to manually choose a checker run C-c ! s.

Automatic insertion of # coding: utf-8

Previously prelude-python had this feature enabled by default, but that is only necessary on Python2, because Python3 already use utf-8 as default encoding. In 2020, python2 becames deprecated, so that functionallity becames a annoying side-effect for some users. If you wish to enable this, add this to your config file:

(setq prelude-python-mode-set-encoding-automatically t)