diff options
author | Franck Cuny <fcuny@twitter.com> | 2019-02-16 14:27:41 -0800 |
---|---|---|
committer | Franck Cuny <fcuny@twitter.com> | 2019-02-16 14:27:41 -0800 |
commit | 3daa8a4ffdfce33cdb88057d6fd90014317b9559 (patch) | |
tree | e06420c1e8b4cc55733a9e9018ea9f79cca65758 | |
parent | [emacs] Split configuration in multiple files. (diff) | |
download | emacs.d-3daa8a4ffdfce33cdb88057d6fd90014317b9559.tar.gz |
[emacs] Simplify flycheck configuration
I do not need custom style for reporting errors. Also move settings to `:custom`.
-rw-r--r-- | emacs.d/custom/fcuny-flycheck.el | 62 |
1 files changed, 13 insertions, 49 deletions
diff --git a/emacs.d/custom/fcuny-flycheck.el b/emacs.d/custom/fcuny-flycheck.el index 26e9b72..4c76d09 100644 --- a/emacs.d/custom/fcuny-flycheck.el +++ b/emacs.d/custom/fcuny-flycheck.el @@ -2,66 +2,30 @@ (use-package flycheck :ensure t + :hook (prog-mode . flycheck-mode ) :custom ((flycheck-idle-change-delay 2) - (flycheck-emacs-lisp-load-path 'inherit)) + (flycheck-emacs-lisp-load-path 'inherit) + (flycheck-highlighting-mode 'lines) + (flycheck-check-syntax-automatically '(mode-enabled save))) :config (progn - (use-package flycheck-pos-tip - :ensure t - :config - (flycheck-pos-tip-mode)) - - (add-hook 'prog-mode-hook 'flycheck-mode) (setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc)) - (setq flycheck-highlighting-mode 'lines) - (setq flycheck-check-syntax-automatically '(mode-enabled save)) - (flycheck-define-checker source-check + (flycheck-define-checker fcuny/source-check-python "A syntax checker for python source code in Source, using `check.pex'" :command ("check.pex" source) - ;;; errors are reported like this: - ;;; E241:ERROR <file name>:<line> <message> + ;;; errors are reported like this: + ;;; E241:ERROR <file name>:<line> <message> :error-patterns ((error line-start (id (1+ nonl)) ":ERROR" (1+ nonl) ":" line (message) line-end) (warning line-start (id (1+ nonl)) ":WARNING" (1+ nonl) ":" line (message) line-end)) :predicate fcuny/check-source-predicate-python-p :modes (python-mode)) - (add-to-list 'flycheck-checkers 'source-check) - - (defface fc/flycheck-error - '((t (:foreground "#f40000"))) - "Face for flycheck error feedback in the modeline." - :group 'fc/flycheck) - (defface fc/flycheck-warning - '((t (:foreground "#724a09"))) - "Face for flycheck warning feedback in the modeline." - :group 'fc/flycheck) - ;;; errors are reported like this: - ;;; E241:ERROR <file name>:<line> <message> - (defface fc/flycheck-info - '((t (:foreground "#19baff"))) - "Face for flycheck info feedback in the modeline." - :group 'fc/flycheck) - (defface fc/flycheck-success - '((t (:foreground "#2cb250"))) - "Face for flycheck success feedback in the modeline." - :group 'fc/flycheck) + (add-to-list 'flycheck-checkers 'fcuny/source-check-python))) - (setq flycheck-mode-line - '(:eval - (pcase flycheck-last-status-change - (`running (propertize " ⟲ Running" 'face 'fc/flycheck-info)) - (`errored (propertize " ⚠ Error" 'face 'fc/flycheck-error)) - (`no-checker (propertize " ⚠ No Checker" 'face 'fc/flycheck-info)) - (`suspicious (propertize " ⚠ Suspicious" 'face 'fc/flycheck-warning)) - (`not-checked (propertize " ✖ Disabled" 'face 'fc/flycheck-info)) - (`interrupted (propertize " ⚠ Interrupted" 'face 'fc/flycheck-warning)) - (`finished - (let* ((error-counts (flycheck-count-errors flycheck-current-errors)) - (no-errors (cdr (assq 'error error-counts))) - (no-warnings (cdr (assq 'warning error-counts))) - (face (cond (no-errors 'fc/flycheck-error) - (no-warnings 'fc/flycheck-warning) - (t 'fc/flycheck-success)))) - (propertize (if (or no-errors no-warnings) (format " ✘ %s/%s Issues" (or no-errors 0) (or no-warnings 0)) " ✔ No Issues") 'face face)))))))) +(use-package flycheck-pos-tip + :after flycheck + :ensure t + :config + (flycheck-pos-tip-mode)) (provide 'fcuny-flycheck) |