feat(emacs/lean-flycheck): delete flycheck temporaries after check

Close #140
This commit is contained in:
Soonho Kong 2014-09-05 16:08:54 -07:00
parent a1e00bb216
commit 50f16ad591
2 changed files with 17 additions and 1 deletions

View file

@ -85,4 +85,18 @@ otherwise."
(when (and (string= major-mode "lean-mode") col) (when (and (string= major-mode "lean-mode") col)
(setf (flycheck-error-column ad-return-value) (1+ col)))))) (setf (flycheck-error-column ad-return-value) (1+ col))))))
(defun lean-flycheck-delete-temporaries ()
"Delete temporaries files generated by flycheck."
(when (eq major-mode 'lean-mode)
(let* ((filename (buffer-file-name))
(tempname (format "%s_%s"
flycheck-temp-prefix
(file-name-nondirectory filename)))
(tempbase (file-name-base tempname))
(tempfile (expand-file-name tempbase
(file-name-directory filename)))
(exts '(".ilean" ".d" ".clean" ".olean"))
(tempfiles (--map (concat tempfile it) exts)))
(mapc #'flycheck-safe-delete tempfiles))))
(provide 'lean-flycheck) (provide 'lean-flycheck)

View file

@ -118,7 +118,9 @@ enabled and disabled respectively.")
(defun lean-mode-setup () (defun lean-mode-setup ()
"Default lean-mode setup" "Default lean-mode setup"
;; Flycheck ;; Flycheck
(when lean-flycheck-use (lean-flycheck-turn-on)) (when lean-flycheck-use
(lean-flycheck-turn-on)
(add-hook 'flycheck-after-syntax-check-hook 'lean-flycheck-delete-temporaries nil t))
;; Draw a vertical line for rule-column ;; Draw a vertical line for rule-column
(when (and lean-rule-column (when (and lean-rule-column
lean-show-rule-column-method) lean-show-rule-column-method)