summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranck Cuny <franck.cuny@gmail.com>2016-11-02 16:11:27 -0700
committerFranck Cuny <franck.cuny@gmail.com>2016-11-02 16:11:27 -0700
commit54b105091900c729d87a7be19b45f44d1f50eed8 (patch)
tree27271f407f421b1d1190c26da2474ec05accd496
parent[emacs] Remove the configuration for time. (diff)
downloademacs.d-54b105091900c729d87a7be19b45f44d1f50eed8.tar.gz
[emacs] Nicer configuration for flycheck.
Diffstat (limited to '')
-rw-r--r--emacs.d/init.el66
1 files changed, 43 insertions, 23 deletions
diff --git a/emacs.d/init.el b/emacs.d/init.el
index 2365f0b..1da46db 100644
--- a/emacs.d/init.el
+++ b/emacs.d/init.el
@@ -107,33 +107,16 @@
:config
(setq flycheck-display-errors-function #'flycheck-pos-tip-error-messages))
+ (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))
+
(defun check-source-predicate ()
(and (executable-find "check.pex")
(buffer-file-name)
(string-match "src/source/.*\.py$" (buffer-file-name))))
- (add-hook 'prog-mode-hook 'flycheck-mode)
- (setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))
-
- (setq flycheck-mode-line
- '(:eval
- (pcase flycheck-last-status-change
- (`not-checked nil)
- (`no-checker (propertize " -" 'face 'warning))
- (`running "")
- (`errored (propertize " ✘" 'face 'error))
- (`finished
- (if flycheck-current-errors
- (let* ((error-counts (flycheck-count-errors flycheck-current-errors))
- (no-errors (cdr (assq 'error error-counts)))
- (no-warnings (cdr (assq 'warning error-counts)))
- (flycheck-face (cond (no-errors 'error)
- (no-warnings 'warning))))
- (propertize (format " [✗:%s/%s]" (or no-errors 0) (or no-warnings 0)) 'face flycheck-face))
- (propertize " [✓]" 'face 'success)))
- (`interrupted " -")
- (`suspicious '(propertize " ?" 'face 'warning)))))
-
(flycheck-define-checker source-check
"A syntax checker for python source code in Source, using `check.pex'"
:command ("check.pex" source)
@@ -143,7 +126,44 @@
(warning line-start (id (1+ nonl)) ":WARNING" (1+ nonl) ":" line (message) line-end))
:predicate check-source-predicate
:modes (python-mode))
- (add-to-list 'flycheck-checkers 'source-check)))
+ (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)
+
+ (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 flyspell
:ensure t