summary refs log tree commit diff
path: root/emacs.d/modules/module-python.el
blob: f4951156012d173d0f408cfb8bfb84a1edc139c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(require 'config-package)

(use-package python
  :mode(("\\.aurora$" . python-mode)
        ("BUILD$"     . python-mode)
        ("\\.py$"     . python-mode))

  :interpreter ("python" . python-mode)

  :config
  (setq python-indent-offset 2)
  (add-hook 'python-mode-hook 'eldoc-mode t))

;;; errors are reported like this:
;;; E241:ERROR   <file name>:<line> <message>
(flycheck-define-checker source-check
  "A syntax checker for python source code in Source, using `check.pex'"
  :command ("check.pex" source)
  :error-patterns ((error line-start (id (1+ nonl)) ":ERROR" (1+ nonl) ":" line (message) line-end)
                   (warning line-start (id (1+ nonl)) ":WARNING" (1+ nonl) ":" line (message) line-end))
  :predicate fc/check-source-p
  :modes (python-mode))

(add-to-list 'flycheck-checkers 'source-check)

(provide 'module-python)