summaryrefslogtreecommitdiff
path: root/modules/flycheck-config.el
blob: f0ca71fea8dc7d1bbc17c7268dde543f95611719 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
;;; flycheck-config --- Syntax/Grammar Check -*- lexical-binding: t; -*-
;;  author Craig Jennings <c@cjennings.net>

;;; Commentary:

;;; Code:

(defun cj/prose-helpers-on ()
  "Ensure that abbrev, flyspell, and flycheck are all on."
  (interactive)
  (if (not (abbrev-mode))
	  (abbrev-mode))
  (flyspell-on-for-buffer-type)
  (if (not (flycheck-mode))
	  (flycheck-mode)))

;;;; ---------------------------------- Linting --------------------------------

(use-package flycheck
  :defer .5
  :hook (sh-mode emacs-lisp-mode)
  :preface
  (defun cj/flycheck-list-errors ()
	"Display flycheck's error list and switch to its buffer."
	(interactive)
	(flycheck-list-errors)
	(switch-to-buffer-other-window "*Flycheck errors*"))
  :bind ("C-; ?" . cj/flycheck-list-errors)
  :config
  ;; don't warn about double-spaces after period.
  (setq-default checkdoc-arguments '("sentence-end-double-space" nil "warn-escape" nil))

  ;; proselint must be installed via the OS
  (flycheck-define-checker proselint
	"A linter for prose."
	:command ("proselint" source-inplace)
	:error-patterns
	((warning line-start (file-name) ":" line ":" column ": "
			  (id (one-or-more (not (any " "))))
			  (message) line-end))
	:modes (text-mode markdown-mode gfm-mode))
  (add-to-list 'flycheck-checkers 'proselint))

(provide 'flycheck-config)
;;; flycheck-config.el ends here