diff options
author | Franck Cuny <franckcuny@gmail.com> | 2015-08-16 22:05:12 -0700 |
---|---|---|
committer | Franck Cuny <franckcuny@gmail.com> | 2015-08-16 22:05:12 -0700 |
commit | 85ccd184568b6c490a271f288d9941e9b3e315c5 (patch) | |
tree | 5b3cede0dd732980f67b4be55fcbfa63f93f73cc | |
parent | [emacs] Disable "fill-column-indicator". (diff) | |
download | emacs.d-85ccd184568b6c490a271f288d9941e9b3e315c5.tar.gz |
[emacs] Add custom checker for Python.
Use `dist.pex` on Python code.
-rw-r--r-- | emacs.d/packages.el | 19 |
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 |