summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--emacs.d/packages.el19
1 files changed, 17 insertions, 2 deletions
diff --git a/emacs.d/packages.el b/emacs.d/packages.el
index 57e4098..bec8e5a 100644
--- a/emacs.d/packages.el
+++ b/emacs.d/packages.el
@@ -35,14 +35,29 @@
 (use-package flycheck
   :ensure t
   :defer t
+  :preface (progn
+             (defun check-source-predicate ()
+               (and (executable-find "check.pex")
+                    (buffer-file-name)
+                    (string-match "src/source/.*\.py$" (buffer-file-name)))))
   :init
   (progn
     (add-hook 'prog-mode-hook 'flycheck-mode)
-    (setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))))
+    (setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc)))
+  :config
+  (progn
+    (flycheck-define-checker source-check
+      "A syntax checker for python source code in Source, using `dist.pex'"
+      :command ("check.pex" source)
+      ;;; errors are reported like this:
+      ;;; E241:ERROR   <file name>:<line> <message>
+      :error-patterns ((error line-start (1+ nonl) ":ERROR" (1+ nonl) ":" line (message) line-end))
+      :predicate check-source-predicate
+      :modes (python-mode))
+    (add-to-list 'flycheck-checkers 'source-check)))
 
 (use-package flyspell
   :ensure t
-  :diminish flyspell-mode "✓"
   :defer t
   :init
   (progn