feat(emacs): provide an option to disable lean-flycheck

This commit is contained in:
Soonho Kong 2014-08-07 11:59:03 -07:00
parent 209ecfd792
commit b684af5cdb
2 changed files with 28 additions and 23 deletions

View file

@ -4,29 +4,29 @@
;; Author: Soonho Kong
;;
(require 'flycheck)
(setq-local lean-lmake-name "lmake")
(setq-local lean-lmake-options "--flycheck")
(eval
`(flycheck-define-checker lean-checker-file
"A Lean syntax checker (file)."
:command (,(lean-get-executable lean-lmake-name) ,lean-lmake-options source-inplace)
:error-patterns
((error line-start "FLYCHECK_BEGIN ERROR\n"
(file-name) ":" line ":" column ": error: "
(minimal-match
(message (one-or-more (one-or-more not-newline) "\n") ))
"FLYCHECK_END" line-end)
(warning line-start "FLYCHECK_BEGIN WARNING\n"
(file-name) ":" line ":" column ": warning "
(when lean-use-flycheck
(require 'flycheck)
(setq-local lean-lmake-name "lmake")
(setq-local lean-lmake-options "--flycheck")
(eval
`(flycheck-define-checker lean-checker-file
"A Lean syntax checker (file)."
:command (,(lean-get-executable lean-lmake-name) ,lean-lmake-options source-inplace)
:error-patterns
((error line-start "FLYCHECK_BEGIN ERROR\n"
(file-name) ":" line ":" column ": error: "
(minimal-match
(message (one-or-more (one-or-more not-newline) "\n") ))
"FLYCHECK_END" line-end))
:modes (lean-mode)
:predicate
(lambda () (and buffer-file-name
(string= "lean" (file-name-extension buffer-file-name))))))
(add-to-list 'flycheck-checkers 'lean-checker-file)
(add-hook 'lean-mode-hook '(lambda () (flycheck-mode t)))
"FLYCHECK_END" line-end)
(warning line-start "FLYCHECK_BEGIN WARNING\n"
(file-name) ":" line ":" column ": warning "
(minimal-match
(message (one-or-more (one-or-more not-newline) "\n") ))
"FLYCHECK_END" line-end))
:modes (lean-mode)
:predicate
(lambda () (and buffer-file-name
(string= "lean" (file-name-extension buffer-file-name))))))
(add-to-list 'flycheck-checkers 'lean-checker-file)
(add-hook 'lean-mode-hook '(lambda () (flycheck-mode t))))
(provide 'lean-flycheck)

View file

@ -30,6 +30,11 @@
:group 'lean
:type 'string)
(defcustom lean-use-flycheck t
"Use flycheck for lean."
:group 'lean
:type 'boolean)
(defcustom lean-delete-trailing-whitespace nil
"Set this variable to true to automatically delete trailing
whitespace when a buffer is loaded from a file or when it is