(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))) :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 : :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 flycheck-pos-tip :defer t :init (progn (eval-after-load 'feature-flycheck '(setq-default flycheck-display-errors-function #'flycheck-pos-tip-error-messages))) :ensure t)