summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emacs.d/init.el80
1 files changed, 41 insertions, 39 deletions
diff --git a/emacs.d/init.el b/emacs.d/init.el
index d8f462a..86eb179 100644
--- a/emacs.d/init.el
+++ b/emacs.d/init.el
@@ -83,47 +83,49 @@
(use-package flycheck
:ensure t
:config
- (use-package flycheck-pos-tip
- :config
- (setq flycheck-display-errors-function #'flycheck-pos-tip-error-messages))
-
- (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)
+ (progn
+ (use-package flycheck-pos-tip
+ :ensure t
+ :config
+ (setq flycheck-display-errors-function #'flycheck-pos-tip-error-messages))
+
+ (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)
;;; 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 check-source-predicate
- :modes (python-mode))
- (add-to-list 'flycheck-checkers 'source-check))
+ :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 check-source-predicate
+ :modes (python-mode))
+ (add-to-list 'flycheck-checkers 'source-check)))
(use-package flyspell
:ensure t