summaryrefslogtreecommitdiffstats
path: root/lisp/init-python.el
blob: e5223b2a66140ed4c08718bfe3c1a8d00b5fdcb2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(defun python-mode-buffer-local-variables ()
  ;; highlight lines longer than 88 characters
  (setq-local fill-column 88)
  ;; use flat index in imenu
  (setq-local imenu-create-index-function
              'python-imenu-create-flat-index))

(use-package python
  :commands python-mode
  :hook (python-mode . python-mode-buffer-local-variables)
  :config
  ;; prefer flake8 as flymake backend
  (when (executable-find "flake8")
    (setq python-flymake-command '("flake8" "-")))

  ;; prefer python3 interpreter
  (when (executable-find "python3")
    (setq python-shell-interpreter "python3")))

(provide 'init-python)