emacs: Use flycheck for python

This commit is contained in:
Tom Willemsen 2013-02-06 11:48:18 +01:00
parent ec68e364d9
commit c3aa5bb8b4
2 changed files with 24 additions and 1 deletions

View file

@ -206,6 +206,29 @@
"Access to a protected member")))) "Access to a protected member"))))
#+END_SRC #+END_SRC
After loading ~flycheck~ Remove the default python checkers and
replace them with my own, which tries both ~flake8~ and ~pylint~.
#+BEGIN_SRC emacs-lisp :tangle init2.el
(eval-after-load "flycheck"
'(progn
(flycheck-declare-checker python-pycheck
"Uses pycheck.sh to check for errors/warnings."
:command '("pycheck.sh" source-inplace)
:error-patterns
'(("^\\(?1:.*\\):\\(?2:[0-9]+\\): Warning (W.*): \\(?4:.*\\)$" warning)
("^\\(?1:.*\\):\\(?2:[0-9]+\\): Error (E.*): \\(?4:.*\\)$" error)
("^\\(?1:.*\\):\\(?2:[0-9]+\\): \\[F\\] \\(?4:.*\\)$" error)
("^\\(?1:.*?\\):\\(?2:[0-9]+\\):\\(?:\\(?3:[0-9]+\\):\\)? \\(?4:E[0-9]+.*\\)$" error)
("^\\(?1:.*?\\):\\(?2:[0-9]+\\):\\(?:\\(?3:[0-9]+\\):\\)? \\(?4:W[0-9]+.*\\)$" warning)
("^\\(?1:.*\\):\\(?2:[0-9]+\\): \\(?4:.*\\)$" error))
:modes 'python-mode)
(mapc (lambda (c) (delete c flycheck-checkers))
'(python-flake8 python-pylint python-pyflakes))
(add-to-list 'flycheck-checkers 'python-pycheck)))
#+END_SRC
** Eshell ** Eshell
Add ~unison~ to the list of =eshell-visual-commands= because it Add ~unison~ to the list of =eshell-visual-commands= because it

View file

@ -376,7 +376,7 @@ When dealing with braces, add another line and indent that too."
(defun oni:python-mode-func () (defun oni:python-mode-func ()
"Function for `python-mode-hook'." "Function for `python-mode-hook'."
(flymake-mode) (flycheck-mode)
(local-set-key (kbd "C->") 'python-indent-shift-right) (local-set-key (kbd "C->") 'python-indent-shift-right)
(local-set-key (kbd "C-<") 'python-indent-shift-left) (local-set-key (kbd "C-<") 'python-indent-shift-left)
(set (make-local-variable 'electric-indent-chars) nil) (set (make-local-variable 'electric-indent-chars) nil)