Enable flycheck for some more modes

Also put all the hook additions in a single place, instead of in each
special function. Both the advantages to this method are:

- Being able to see in a second where flycheck is enabled.
- If all minor modes are added separately it's easy to see exactly
  which are enabled for a specific mode, just by looking at its hook
  variable.
This commit is contained in:
Tom Willemse 2013-04-15 00:11:37 +02:00
parent 2f9e38cab2
commit 881a2bb3e5
2 changed files with 18 additions and 7 deletions

View file

@ -57,6 +57,21 @@ package.el is loaded anyway."
(add-hook 'sawfish-mode-hook 'paredit-mode) (add-hook 'sawfish-mode-hook 'paredit-mode)
(add-hook 'scheme-mode-hook 'paredit-mode) (add-hook 'scheme-mode-hook 'paredit-mode)
;;; Enable Flycheck for some modes.
(add-hook 'css-mode-hook 'flycheck-mode)
(add-hook 'emacs-lisp-mode-hook 'flycheck-mode)
(add-hook 'go-mode-hook 'flycheck-mode)
(add-hook 'html-mode-hook 'flycheck-mode)
(add-hook 'js2-mode-hook 'flycheck-mode)
(add-hook 'lua-mode-hook 'flycheck-mode)
(add-hook 'php-mode-hook 'flycheck-mode)
(add-hook 'python-mode-hook 'flycheck-mode)
(add-hook 'rst-mode-hook 'flycheck-mode)
(add-hook 'ruby-mode-hook 'flycheck-mode)
(add-hook 'rust-mode-hook 'flycheck-mode)
(add-hook 'sh-mode-hook 'flycheck-mode)
;;; Remove the pylint and pyflakes checkers from the flycheck ;;; Remove the pylint and pyflakes checkers from the flycheck
;;; configuration so the flake8 checker remains. ;;; configuration so the flake8 checker remains.
(eval-after-load "flycheck" (eval-after-load "flycheck"

View file

@ -126,8 +126,7 @@ DOT are intentionally being skipped."
(defun oni:html-mode-func () (defun oni:html-mode-func ()
"Function for `html-mode-hook'." "Function for `html-mode-hook'."
(yas-minor-mode) (yas-minor-mode)
(fci-mode) (fci-mode))
(flycheck-mode))
(defun oni:indent-shift-left (start end &optional count) (defun oni:indent-shift-left (start end &optional count)
"Rigidly indent region. "Rigidly indent region.
@ -224,8 +223,7 @@ If COUNT has been specified indent by that much, otherwise look at
"Function for `lua-mode-hook'." "Function for `lua-mode-hook'."
(local-unset-key (kbd ")")) (local-unset-key (kbd ")"))
(local-unset-key (kbd "]")) (local-unset-key (kbd "]"))
(local-unset-key (kbd "}")) (local-unset-key (kbd "}")))
(flycheck-mode))
(defun oni:magit-log-edit-mode-func () (defun oni:magit-log-edit-mode-func ()
"Function for `magit-log-edit-mode-hook'." "Function for `magit-log-edit-mode-hook'."
@ -340,8 +338,7 @@ When dealing with braces, add another line and indent that too."
(c-set-offset 'arglist-intro '+) (c-set-offset 'arglist-intro '+)
(c-set-offset 'arglist-close '0) (c-set-offset 'arglist-close '0)
(rainbow-delimiters-mode) (rainbow-delimiters-mode)
(setq-local fci-rule-column 80) (setq-local fci-rule-column 80))
(flycheck-mode))
(defun oni:prog-mode-func () (defun oni:prog-mode-func ()
"Function for `prog-mode-hook'." "Function for `prog-mode-hook'."
@ -352,7 +349,6 @@ 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'."
(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)