Add flycheck configuration

This commit is contained in:
Tom Willemse 2016-08-06 20:36:08 +02:00
parent ed329adacd
commit 27e1b90637

View file

@ -350,6 +350,51 @@ To start off, first I need to enable lexical binding.
(add-hook 'electric-indent-local-mode-hook #'oni:switch-newline-keys)
#+END_SRC
** Flycheck
Flycheck lets me see (compiler) errors, warnings and info messages
while writing code.
#+BEGIN_SRC emacs-lisp
(ensure-library flycheck)
#+END_SRC
When developing packages with Cask, some special care needs to be
taken to ensure the checkers work correctly.
#+BEGIN_SRC emacs-lisp
(ensure-library flycheck-cask)
(add-hook 'flycheck-mode-hook 'flycheck-cask-setup)
#+END_SRC
I disable the pylint and pyflakes checkers because they don't seem
to add much except noise when used together with flake8. Also
pylint seems hell-bent on making Python written like a
statically-typed langauge.
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'flycheck
(mapc (lambda (c) (delq c flycheck-checkers))
'(python-pylint python-pyflakes)))
#+END_SRC
Also show which columns messages appear in.
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'flycheck
(setq flycheck-highlighting-mode 'columns))
#+END_SRC
Show the error message at point in a tooltip.
#+BEGIN_SRC emacs-lisp
(ensure-library flycheck-pos-tip)
(with-eval-after-load 'flycheck
(require 'flycheck-pos-tip)
(flycheck-pos-tip-mode))
#+END_SRC
* Major modes
** Emacs lisp mode
@ -455,6 +500,12 @@ To start off, first I need to enable lexical binding.
(add-hook 'python-mode-hook 'electric-pair-local-mode)
#+END_SRC
Enable syntax and style checking with flycheck.
#+BEGIN_SRC emacs-lisp
(add-hook 'python-mode-hook 'flycheck-mode)
#+END_SRC
* Applications
** Magit