2015-04-11 02:23:16 +00:00
|
|
|
;;; packages.el --- Syntax Checking Layer packages File for Spacemacs
|
|
|
|
;;
|
2016-01-12 02:40:54 +00:00
|
|
|
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
|
2015-04-11 02:23:16 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2015-04-19 03:40:24 +00:00
|
|
|
(setq syntax-checking-packages
|
2015-04-11 02:23:16 +00:00
|
|
|
'(
|
|
|
|
flycheck
|
2015-04-28 03:37:26 +00:00
|
|
|
flycheck-pos-tip
|
2015-04-11 02:23:16 +00:00
|
|
|
popwin
|
|
|
|
))
|
|
|
|
|
|
|
|
(defun syntax-checking/init-flycheck ()
|
|
|
|
(use-package flycheck
|
2016-04-03 04:36:49 +00:00
|
|
|
:defer t
|
2015-04-11 02:23:16 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2016-01-27 20:08:25 +00:00
|
|
|
(setq flycheck-standard-error-navigation nil
|
|
|
|
flycheck-global-modes nil)
|
|
|
|
|
2015-04-11 02:23:16 +00:00
|
|
|
(spacemacs|add-toggle syntax-checking
|
2015-07-25 13:14:53 +00:00
|
|
|
:status flycheck-mode
|
|
|
|
:on (flycheck-mode)
|
|
|
|
:off (flycheck-mode -1)
|
|
|
|
:documentation "Enable error and syntax checking."
|
2016-01-27 20:08:25 +00:00
|
|
|
:evil-leader "ts")
|
|
|
|
|
2015-05-14 02:55:32 +00:00
|
|
|
(spacemacs|diminish flycheck-mode " ⓢ" " s")
|
2015-04-11 02:23:16 +00:00
|
|
|
|
2016-01-27 20:08:25 +00:00
|
|
|
(when syntax-checking-enable-by-default
|
|
|
|
(global-flycheck-mode 1))
|
|
|
|
|
2015-04-11 02:23:16 +00:00
|
|
|
;; Custom fringe indicator
|
|
|
|
(when (fboundp 'define-fringe-bitmap)
|
|
|
|
(define-fringe-bitmap 'my-flycheck-fringe-indicator
|
|
|
|
(vector #b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00011100
|
|
|
|
#b00111110
|
|
|
|
#b00111110
|
|
|
|
#b00111110
|
|
|
|
#b00011100
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
2015-10-28 13:13:37 +00:00
|
|
|
#b00000000)))
|
2015-04-11 02:23:16 +00:00
|
|
|
|
|
|
|
(flycheck-define-error-level 'error
|
2016-05-03 20:57:07 +00:00
|
|
|
:severity 2
|
2015-04-11 02:23:16 +00:00
|
|
|
:overlay-category 'flycheck-error-overlay
|
|
|
|
:fringe-bitmap 'my-flycheck-fringe-indicator
|
|
|
|
:fringe-face 'flycheck-fringe-error)
|
|
|
|
|
|
|
|
(flycheck-define-error-level 'warning
|
2016-05-03 20:57:07 +00:00
|
|
|
:severity 1
|
2015-04-11 02:23:16 +00:00
|
|
|
:overlay-category 'flycheck-warning-overlay
|
|
|
|
:fringe-bitmap 'my-flycheck-fringe-indicator
|
|
|
|
:fringe-face 'flycheck-fringe-warning)
|
|
|
|
|
|
|
|
(flycheck-define-error-level 'info
|
2016-05-03 20:57:07 +00:00
|
|
|
:severity 0
|
2015-04-11 02:23:16 +00:00
|
|
|
:overlay-category 'flycheck-info-overlay
|
|
|
|
:fringe-bitmap 'my-flycheck-fringe-indicator
|
|
|
|
:fringe-face 'flycheck-fringe-info)
|
|
|
|
|
2015-08-27 12:34:20 +00:00
|
|
|
;; toggle flycheck window
|
|
|
|
(defun spacemacs/toggle-flycheck-error-list ()
|
|
|
|
"Toggle flycheck's error list window.
|
|
|
|
If the error list is visible, hide it. Otherwise, show it."
|
|
|
|
(interactive)
|
|
|
|
(-if-let (window (flycheck-get-error-list-window))
|
|
|
|
(quit-window nil window)
|
|
|
|
(flycheck-list-errors)))
|
|
|
|
|
2016-01-21 19:13:50 +00:00
|
|
|
(defun spacemacs/goto-flycheck-error-list ()
|
|
|
|
"Open and go to the error list buffer."
|
|
|
|
(interactive)
|
|
|
|
(unless (get-buffer-window (get-buffer flycheck-error-list-buffer))
|
2016-04-27 19:22:19 +00:00
|
|
|
(flycheck-list-errors)
|
|
|
|
(switch-to-buffer-other-window flycheck-error-list-buffer)))
|
2016-01-21 19:13:50 +00:00
|
|
|
|
2015-11-21 10:07:14 +00:00
|
|
|
(evilified-state-evilify-map flycheck-error-list-mode-map
|
|
|
|
:mode flycheck-error-list-mode
|
|
|
|
:bindings
|
|
|
|
"RET" 'flycheck-error-list-goto-error
|
|
|
|
"j" 'flycheck-error-list-next-error
|
|
|
|
"k" 'flycheck-error-list-previous-error)
|
2015-11-13 17:38:15 +00:00
|
|
|
|
|
|
|
;; key bindings
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys
|
2015-11-13 17:38:15 +00:00
|
|
|
"ec" 'flycheck-clear
|
|
|
|
"eh" 'flycheck-describe-checker
|
|
|
|
"el" 'spacemacs/toggle-flycheck-error-list
|
2016-01-21 19:13:50 +00:00
|
|
|
"eL" 'spacemacs/goto-flycheck-error-list
|
2015-11-13 17:38:15 +00:00
|
|
|
"es" 'flycheck-select-checker
|
|
|
|
"eS" 'flycheck-set-checker-executable
|
|
|
|
"ev" 'flycheck-verify-setup))))
|
2015-04-11 02:23:16 +00:00
|
|
|
|
|
|
|
(defun syntax-checking/init-flycheck-pos-tip ()
|
|
|
|
(use-package flycheck-pos-tip
|
2015-04-28 03:37:26 +00:00
|
|
|
:if syntax-checking-enable-tooltips
|
2015-04-11 02:23:16 +00:00
|
|
|
:defer t
|
|
|
|
:init
|
2015-11-13 10:21:31 +00:00
|
|
|
(with-eval-after-load 'flycheck
|
|
|
|
(flycheck-pos-tip-mode))))
|
2015-04-11 02:23:16 +00:00
|
|
|
|
|
|
|
(defun syntax-checking/post-init-popwin ()
|
2015-11-13 10:19:31 +00:00
|
|
|
(push '("^\\*Flycheck.+\\*$"
|
|
|
|
:regexp t
|
|
|
|
:dedicated t
|
|
|
|
:position bottom
|
|
|
|
:stick t
|
|
|
|
:noselect t)
|
|
|
|
popwin:special-display-config))
|