Emacs config utilizing prelude as a base
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.7 KiB

  1. # Prelude Python
  2. !!! Note
  3. This module builds on top of the shared [Programming](programming.md) module.
  4. ## Python Mode
  5. Emacs comes with Python programming support through the built-in
  6. `python-mode`. Whenever you are editing Python code run `C-h m` to
  7. look at the Python mode key bindings. Alternatively look at the
  8. menu bar entries under Python. To toggle the menu bar press `F12`.
  9. ## Anaconda Mode
  10. Prelude bundles the powerful
  11. [anaconda-mode](https://github.com/pythonic-emacs/anaconda-mode),
  12. which provides code navigation, documentation lookup and completion for Python.
  13. Anaconda has integration with popular modes like `company` and `eldoc`.
  14. ## Syntax checking
  15. Prelude ships with [Flycheck](https://github.com/flycheck/flycheck),
  16. an on the fly syntax checker. Flycheck has support for two Python
  17. syntax checkers, [Pylint](http://www.pylint.org/) and
  18. [Flake8](http://flake8.readthedocs.org/en/latest/). In
  19. order to have Flycheck support on the fly syntax checking for
  20. Python you need to have either of these installed and accessible to
  21. Emacs. In order to manually choose a checker run `C-c ! s`.
  22. ## Automatic insertion of file encoding comments
  23. You can have Prelude auto-detect the encoding of a source buffer and
  24. insert the appropriate `# coding:` comments. If you wish to enable
  25. this, add the following to your configuration:
  26. ```emacs-lisp
  27. (setq prelude-python-mode-set-encoding-automatically t)
  28. ```
  29. !!! Note
  30. Previously `prelude-python` had this feature enabled by default (up to Prelude 1.1), but
  31. it is only necessary on Python 2, because Python 3 uses utf-8
  32. as the default file encoding. In 2020 Python 2 became deprecated, so that
  33. functionality became mostly obsolete.