feature/{syntax-checker,spellcheck} -> tools/fly{check,spell}

This commit is contained in:
Henrik Lissner 2019-02-22 00:20:29 -05:00
parent 88f50bbdec
commit 69ed1a4a99
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
46 changed files with 147 additions and 110 deletions

View file

@ -0,0 +1,44 @@
;;; tools/flycheck/autoload.el -*- lexical-binding: t; -*-
(defun +flycheck-show-popup (errors)
"TODO"
(if (and EMACS26+
(featurep! +childframe)
(display-graphic-p))
(flycheck-posframe-show-posframe errors)
(flycheck-popup-tip-show-popup errors)))
(defun +flycheck-cleanup-popup ()
"TODO"
(when (display-graphic-p)
(flycheck-popup-tip-delete-popup)))
;;;###autoload
(define-minor-mode +flycheck-popup-mode
"TODO"
:lighter nil
:group 'doom
(require 'flycheck-popup-tip)
(let ((hooks '(post-command-hook focus-out-hook)))
(cond
;; Use our display function and remember the old one but only if we haven't
;; yet configured it, to avoid activating twice.
((and +flycheck-popup-mode
(not (eq flycheck-display-errors-function
#'+flycheck-show-popup)))
(setq flycheck-popup-tip-old-display-function
flycheck-display-errors-function
flycheck-display-errors-function
#'+flycheck-show-popup)
(dolist (hook hooks)
(add-hook hook #'+flycheck-cleanup-popup nil t)))
;; Reset the display function and remove ourselves from all hooks but only
;; if the mode is still active.
((and (not +flycheck-popup-mode)
(eq flycheck-display-errors-function
#'+flycheck-show-popup))
(setq flycheck-display-errors-function
flycheck-popup-tip-old-display-function
flycheck-popup-tip-old-display-function nil)
(dolist (hook hooks)
(remove-hook hook '+flycheck-cleanup-popup t))))))

View file

@ -0,0 +1,45 @@
;;; tools/flycheck/config.el -*- lexical-binding: t; -*-
(defvar +flycheck-on-escape t
"If non-nil, flycheck will recheck the current buffer when pressing ESC/C-g.")
;;
;; Packages
(def-package! flycheck
:commands (flycheck-list-errors flycheck-buffer)
:after-call (doom-enter-buffer-hook after-find-file)
:config
;; Emacs feels snappier without checks on newline
(setq flycheck-check-syntax-automatically (delq 'new-line flycheck-check-syntax-automatically))
(defun +flycheck|buffer ()
"Flycheck buffer on ESC in normal mode."
(when (and flycheck-mode +flycheck-on-escape)
(ignore-errors (flycheck-buffer))
nil))
(add-hook 'doom-escape-hook #'+flycheck|buffer t)
(after! evil
(setq-hook! 'evil-insert-state-entry-hook
flycheck-idle-change-delay 1.75)
(setq-hook! 'evil-insert-state-exit-hook
flycheck-idle-change-delay (default-value 'flycheck-idle-change-delay)))
(global-flycheck-mode +1))
(def-package! flycheck-popup-tip
:commands (flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup)
:init (add-hook 'flycheck-mode-hook #'+flycheck-popup-mode)
:config (setq flycheck-popup-tip-error-prefix ""))
(def-package! flycheck-posframe
:when (and EMACS26+ (featurep! +childframe))
:commands flycheck-posframe-show-posframe
:config
(setq flycheck-posframe-warning-prefix ""
flycheck-posframe-info-prefix "··· "
flycheck-posframe-error-prefix ""))

View file

@ -0,0 +1,7 @@
;; -*- no-byte-compile: t; -*-
;;; tools/flycheck/packages.el
(package! flycheck)
(package! flycheck-popup-tip)
(when (and EMACS26+ (featurep! +childframe))
(package! flycheck-posframe))