feature/{syntax-checker,spellcheck} -> tools/fly{check,spell}
This commit is contained in:
parent
88f50bbdec
commit
69ed1a4a99
46 changed files with 147 additions and 110 deletions
|
@ -1,40 +0,0 @@
|
|||
;;; feature/spellcheck/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar-local +spellcheck-immediately t
|
||||
"If non-nil, spellcheck the current buffer upon starting `flyspell-mode'.
|
||||
|
||||
Since spellchecking can be slow in some buffers, this can be disabled with:
|
||||
|
||||
(setq-hook! 'TeX-mode-hook +spellcheck-immediately nil)")
|
||||
|
||||
;; `ispell'
|
||||
(setq ispell-dictionary "english"
|
||||
ispell-list-command "--list"
|
||||
ispell-extr-args '("--dont-tex-check-comments"))
|
||||
|
||||
(after! ispell
|
||||
(when (equal (file-name-base ispell-program-name) "aspell")
|
||||
(add-to-list 'ispell-extra-args "--sug-mode=ultra")))
|
||||
|
||||
|
||||
(def-package! flyspell ; built-in
|
||||
:defer t
|
||||
:init (add-hook 'flyspell-mode-hook #'+spellcheck|immediately)
|
||||
:config
|
||||
(defun +spellcheck|immediately ()
|
||||
"Spellcheck the buffer when `flyspell-mode' is enabled."
|
||||
(when (and flyspell-mode +spellcheck-immediately)
|
||||
(flyspell-buffer))))
|
||||
|
||||
|
||||
(def-package! flyspell-correct
|
||||
:commands (flyspell-correct-word-generic
|
||||
flyspell-correct-previous-word-generic)
|
||||
:config
|
||||
(cond ((featurep! :completion helm)
|
||||
(require 'flyspell-correct-helm))
|
||||
((featurep! :completion ivy)
|
||||
(require 'flyspell-correct-ivy))
|
||||
((require 'flyspell-correct-popup)
|
||||
(setq flyspell-popup-correct-delay 0.8)
|
||||
(define-key popup-menu-keymap [escape] #'keyboard-quit))))
|
|
@ -1,10 +0,0 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; feature/spellcheck/packages.el
|
||||
|
||||
(package! flyspell-correct)
|
||||
(cond ((featurep! :completion ivy)
|
||||
(package! flyspell-correct-ivy))
|
||||
((featurep! :completion helm)
|
||||
(package! flyspell-correct-helm))
|
||||
((package! flyspell-correct-popup)))
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
;;; feature/syntax-checker/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defun +syntax-checker-show-popup (errors)
|
||||
"TODO"
|
||||
(if (and EMACS26+
|
||||
(featurep! +childframe)
|
||||
(display-graphic-p))
|
||||
(flycheck-posframe-show-posframe errors)
|
||||
(flycheck-popup-tip-show-popup errors)))
|
||||
|
||||
(defun +syntax-checker-cleanup-popup ()
|
||||
"TODO"
|
||||
(when (display-graphic-p)
|
||||
(flycheck-popup-tip-delete-popup)))
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode +syntax-checker-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 +syntax-checker-popup-mode
|
||||
(not (eq flycheck-display-errors-function
|
||||
#'+syntax-checker-show-popup)))
|
||||
(setq flycheck-popup-tip-old-display-function
|
||||
flycheck-display-errors-function
|
||||
flycheck-display-errors-function
|
||||
#'+syntax-checker-show-popup)
|
||||
(dolist (hook hooks)
|
||||
(add-hook hook #'+syntax-checker-cleanup-popup nil t)))
|
||||
;; Reset the display function and remove ourselves from all hooks but only
|
||||
;; if the mode is still active.
|
||||
((and (not +syntax-checker-popup-mode)
|
||||
(eq flycheck-display-errors-function
|
||||
#'+syntax-checker-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 '+syntax-checker-cleanup-popup t))))))
|
|
@ -1,38 +0,0 @@
|
|||
;;; feature/syntax-checker/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(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 '(save idle-change mode-enabled))
|
||||
|
||||
(after! evil
|
||||
(defun +syntax-checkers|flycheck-buffer ()
|
||||
"Flycheck buffer on ESC in normal mode."
|
||||
(when flycheck-mode
|
||||
(ignore-errors (flycheck-buffer))
|
||||
nil))
|
||||
(add-hook 'doom-escape-hook #'+syntax-checkers|flycheck-buffer t)
|
||||
|
||||
(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 #'+syntax-checker-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 "✕ "))
|
|
@ -1,7 +0,0 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; feature/syntax-checker/packages.el
|
||||
|
||||
(package! flycheck)
|
||||
(package! flycheck-popup-tip)
|
||||
(when (and EMACS26+ (featurep! +childframe))
|
||||
(package! flycheck-posframe))
|
Loading…
Add table
Add a link
Reference in a new issue