summary refs log tree commit diff
path: root/emacs.d/modules/module-python.el
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--emacs.d/modules/module-python.el26
1 files changed, 26 insertions, 0 deletions
diff --git a/emacs.d/modules/module-python.el b/emacs.d/modules/module-python.el
new file mode 100644
index 0000000..f495115
--- /dev/null
+++ b/emacs.d/modules/module-python.el
@@ -0,0 +1,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)