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

@ -12,7 +12,9 @@
"A list of module root directories. Order determines priority.") "A list of module root directories. Order determines priority.")
(defconst doom-obsolete-modules (defconst doom-obsolete-modules
'((:feature (version-control (:emacs vc) (:ui vc-gutter))) '((:feature (version-control (:emacs vc) (:ui vc-gutter))
(spellcheck (:tools flyspell))
(syntax-checker (:tools flycheck)))
(:tools (rotate-text (:editor rotate-text))) (:tools (rotate-text (:editor rotate-text)))
(:emacs (electric-indent (:emacs electric)) (:emacs (electric-indent (:emacs electric))
(hideshow (:editor fold)))) (hideshow (:editor fold))))

View file

@ -9,8 +9,6 @@
(lookup ; helps you navigate your code and documentation (lookup ; helps you navigate your code and documentation
+docsets) ; ...or in Dash docsets locally +docsets) ; ...or in Dash docsets locally
snippets ; my elves. They type so I don't have to snippets ; my elves. They type so I don't have to
spellcheck ; tasing you for misspelling mispelling
syntax-checker ; tasing you for every semicolon you forget
workspaces ; tab emulation, persistence & separate workspaces workspaces ; tab emulation, persistence & separate workspaces
:completion :completion
@ -66,6 +64,8 @@
;;docker ;;docker
;;editorconfig ; let someone else argue about tabs vs spaces ;;editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs ;;ein ; tame Jupyter notebooks with emacs
flycheck ; tasing you for every semicolon you forget
;;flyspell ; tasing you for misspelling mispelling
;;gist ; interacting with github gists ;;gist ; interacting with github gists
;;lsp ;;lsp
;;macos ; MacOS-specific commands ;;macos ; MacOS-specific commands

View file

@ -96,7 +96,7 @@
(defun +email*refresh (&rest _) (mu4e-headers-rerun-search)) (defun +email*refresh (&rest _) (mu4e-headers-rerun-search))
(advice-add #'mu4e-mark-execute-all :after #'+email*refresh) (advice-add #'mu4e-mark-execute-all :after #'+email*refresh)
(when (featurep! :feature spellcheck) (when (featurep! :tools flyspell)
(add-hook 'mu4e-compose-mode-hook #'flyspell-mode)) (add-hook 'mu4e-compose-mode-hook #'flyspell-mode))
;; Wrap text in messages ;; Wrap text in messages

View file

@ -190,7 +190,7 @@ playback.")
(define-key lui-mode-map "\C-u" #'lui-kill-to-beginning-of-line) (define-key lui-mode-map "\C-u" #'lui-kill-to-beginning-of-line)
(setq lui-fill-type nil) (setq lui-fill-type nil)
(when (featurep! :feature spellcheck) (when (featurep! :tools flyspell)
(setq lui-flyspell-p t)) (setq lui-flyspell-p t))
(after! evil (after! evil

View file

@ -215,14 +215,14 @@
[backspace] #'+snippets/delete-backward-char [backspace] #'+snippets/delete-backward-char
[delete] #'+snippets/delete-forward-char-or-field))) [delete] #'+snippets/delete-forward-char-or-field)))
(:when (featurep! :feature spellcheck) (:when (featurep! :tools flyspell)
:m "]S" #'flyspell-correct-word-generic :m "]S" #'flyspell-correct-word-generic
:m "[S" #'flyspell-correct-previous-word-generic :m "[S" #'flyspell-correct-previous-word-generic
(:map flyspell-mouse-map (:map flyspell-mouse-map
"RET" #'flyspell-correct-word-generic "RET" #'flyspell-correct-word-generic
[mouse-1] #'flyspell-correct-word-generic)) [mouse-1] #'flyspell-correct-word-generic))
(:when (featurep! :feature syntax-checker) (:when (featurep! :tools flycheck)
:m "]e" #'next-error :m "]e" #'next-error
:m "[e" #'previous-error :m "[e" #'previous-error
(:after flycheck (:after flycheck

View file

@ -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))))

View file

@ -146,7 +146,7 @@ compilation database is present in the project.")
:hook (irony-mode . irony-eldoc)) :hook (irony-mode . irony-eldoc))
(def-package! flycheck-irony (def-package! flycheck-irony
:when (featurep! :feature syntax-checker) :when (featurep! :tools flycheck)
:config (flycheck-irony-setup)) :config (flycheck-irony-setup))
(def-package! company-irony (def-package! company-irony

View file

@ -16,7 +16,7 @@
(package! cquery) (package! cquery)
(when (package! irony) (when (package! irony)
(package! irony-eldoc) (package! irony-eldoc)
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(package! flycheck-irony)) (package! flycheck-irony))
(when (featurep! :completion company) (when (featurep! :completion company)
(package! company-irony) (package! company-irony)

View file

@ -106,5 +106,5 @@
:desc "refactor" "R" #'hydra-cljr-help-menu/body)) :desc "refactor" "R" #'hydra-cljr-help-menu/body))
(def-package! flycheck-joker (def-package! flycheck-joker
:when (featurep! :feature syntax-checker) :when (featurep! :tools flycheck)
:after flycheck)) :after flycheck))

View file

@ -4,5 +4,5 @@
(package! cider) (package! cider)
(package! clj-refactor) (package! clj-refactor)
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(package! flycheck-joker)) (package! flycheck-joker))

View file

@ -13,7 +13,7 @@
(def-package! flycheck-crystal (def-package! flycheck-crystal
:when (featurep! :feature syntax-checker) :when (featurep! :tools flycheck)
:after crystal-mode) :after crystal-mode)

View file

@ -43,7 +43,7 @@
(remove-hook 'alchemist-iex-mode-hook fn))) (remove-hook 'alchemist-iex-mode-hook fn)))
(def-package! flycheck-credo (def-package! flycheck-credo
:when (featurep! :feature syntax-checker) :when (featurep! :tools flycheck)
:config (flycheck-credo-setup))) :config (flycheck-credo-setup)))

View file

@ -4,5 +4,5 @@
;; +elixir.el ;; +elixir.el
(package! elixir-mode) (package! elixir-mode)
(package! alchemist) (package! alchemist)
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(package! flycheck-credo)) (package! flycheck-credo))

View file

@ -19,7 +19,7 @@
(def-package! flycheck-elm (def-package! flycheck-elm
:when (featurep! :feature syntax-checker) :when (featurep! :tools flycheck)
:after elm-mode :after elm-mode
:config (add-to-list 'flycheck-checkers 'elm nil #'eq)) :config (add-to-list 'flycheck-checkers 'elm nil #'eq))

View file

@ -2,6 +2,6 @@
;;; lang/elm/packages.el ;;; lang/elm/packages.el
(package! elm-mode) (package! elm-mode)
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(package! flycheck-elm)) (package! flycheck-elm))

View file

@ -107,7 +107,7 @@
(def-package! flycheck-cask (def-package! flycheck-cask
:when (featurep! :feature syntax-checker) :when (featurep! :tools flycheck)
:defer t :defer t
:init :init
(add-hook! 'emacs-lisp-mode-hook (add-hook! 'emacs-lisp-mode-hook

View file

@ -7,5 +7,5 @@
(package! overseer) (package! overseer)
(package! elisp-def) (package! elisp-def)
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(package! flycheck-cask)) (package! flycheck-cask))

View file

@ -9,7 +9,7 @@
(def-package! flycheck-rebar3 (def-package! flycheck-rebar3
:when (featurep! :feature syntax-checker) :when (featurep! :tools flycheck)
:after flycheck :after flycheck
:config (flycheck-rebar3-setup)) :config (flycheck-rebar3-setup))

View file

@ -3,7 +3,7 @@
(package! erlang) (package! erlang)
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(package! flycheck-rebar3)) (package! flycheck-rebar3))
(when (featurep! :completion ivy) (when (featurep! :completion ivy)

View file

@ -14,7 +14,7 @@
"-fdefer-typed-holes" "-fdefer-typed-holes"
"-fdefer-type-errors")) "-fdefer-type-errors"))
:config :config
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(flycheck-add-next-checker 'haskell-dante '(warning . haskell-hlint))) (flycheck-add-next-checker 'haskell-dante '(warning . haskell-hlint)))
(set-company-backend! 'dante-mode #'dante-company) (set-company-backend! 'dante-mode #'dante-company)

View file

@ -16,7 +16,7 @@ This is necessary because `intero-mode' doesn't do its own error checks."
(setq haskell-compile-cabal-build-command "stack build --fast") (setq haskell-compile-cabal-build-command "stack build --fast")
(set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition) (set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition)
(set-company-backend! 'intero-mode 'intero-company) (set-company-backend! 'intero-mode 'intero-company)
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(flycheck-add-next-checker 'intero '(warning . haskell-hlint))) (flycheck-add-next-checker 'intero '(warning . haskell-hlint)))
(when (featurep 'evil) (when (featurep 'evil)

View file

@ -9,7 +9,7 @@
(after! haskell-mode (after! haskell-mode
(setq haskell-process-suggest-remove-import-lines t ; warnings for redundant imports etc (setq haskell-process-suggest-remove-import-lines t ; warnings for redundant imports etc
haskell-process-auto-import-loaded-modules t) haskell-process-auto-import-loaded-modules t)
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(setq haskell-process-show-overlays nil)) ; flycheck makes this unnecessary (setq haskell-process-show-overlays nil)) ; flycheck makes this unnecessary
(add-hook! 'haskell-mode-hook (add-hook! 'haskell-mode-hook
#'(haskell-collapse-mode ; support folding haskell code blocks #'(haskell-collapse-mode ; support folding haskell code blocks

View file

@ -6,7 +6,7 @@
:init :init
(setq meghanada-server-install-dir (concat doom-etc-dir "meghanada-server/") (setq meghanada-server-install-dir (concat doom-etc-dir "meghanada-server/")
meghanada-use-company (featurep! :completion company) meghanada-use-company (featurep! :completion company)
meghanada-use-flycheck (featurep! :feature syntax-checker) meghanada-use-flycheck (featurep! :tools flycheck)
meghanada-use-eldoc t meghanada-use-eldoc t
meghanada-use-auto-start t) meghanada-use-auto-start t)
:config :config

View file

@ -73,7 +73,7 @@
(add-to-list 'magic-mode-alist '(+javascript-jsx-file-p . rjsx-mode)) (add-to-list 'magic-mode-alist '(+javascript-jsx-file-p . rjsx-mode))
:config :config
(set-electric! 'rjsx-mode :chars '(?\} ?\) ?. ?>)) (set-electric! 'rjsx-mode :chars '(?\} ?\) ?. ?>))
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(add-hook! 'rjsx-mode-hook (add-hook! 'rjsx-mode-hook
;; jshint doesn't know how to deal with jsx ;; jshint doesn't know how to deal with jsx
(push 'javascript-jshint flycheck-disabled-checkers))) (push 'javascript-jshint flycheck-disabled-checkers)))

View file

@ -65,7 +65,7 @@ If no viewers are found, `latex-preview-pane' is used.")
'local)) 'local))
;; Enable rainbow mode after applying styles to the buffer ;; Enable rainbow mode after applying styles to the buffer
(add-hook 'TeX-update-style-hook #'rainbow-delimiters-mode) (add-hook 'TeX-update-style-hook #'rainbow-delimiters-mode)
(when (featurep! :feature spellcheck) (when (featurep! :tools flyspell)
(add-hook 'latex-mode-local-vars-hook #'flyspell-mode)) (add-hook 'latex-mode-local-vars-hook #'flyspell-mode))
;; All these excess pairs dramatically slow down typing in latex buffers, so ;; All these excess pairs dramatically slow down typing in latex buffers, so
;; we remove them. Let snippets do their job. ;; we remove them. Let snippets do their job.

View file

@ -21,7 +21,7 @@
(def-package! flycheck-ledger (def-package! flycheck-ledger
:when (featurep! :feature syntax-checker) :when (featurep! :tools flycheck)
:after ledger-mode) :after ledger-mode)

View file

@ -6,5 +6,5 @@
(when (featurep! :feature evil) (when (featurep! :feature evil)
(package! evil-ledger)) (package! evil-ledger))
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(package! flycheck-ledger)) (package! flycheck-ledger))

View file

@ -37,6 +37,6 @@ windows."
(def-package! flycheck-nim (def-package! flycheck-nim
:when (featurep! :feature syntax-checker) :when (featurep! :tools flycheck)
:after nim-mode) :after nim-mode)

View file

@ -5,5 +5,5 @@
(package! nim-mode) (package! nim-mode)
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(package! flycheck-nim)) (package! flycheck-nim))

View file

@ -50,10 +50,10 @@ opam install merlin utop ocp-indent dune ocamlformat
* Configuration * Configuration
+ if =:completion company= is enabled then autocomplete is provided by =merlin= + if =:completion company= is enabled then autocomplete is provided by =merlin=
+ when =:feature syntax-checker= is enabled then =flycheck-ocaml= is activated + when =:tools flycheck= is enabled then =flycheck-ocaml= is activated to do
to do on-the-fly syntax/type checking via =merlin=, otherwise this is only on-the-fly syntax/type checking via =merlin=, otherwise this is only done when
done when the file is saved. the file is saved.
+ spell checking is activated in comments if =:feature spellcheck= is active + spell checking is activated in comments if =:tools flyspell= is active
+ a REPL is provided if =utop= is installed and =:feature eval= is active + a REPL is provided if =utop= is installed and =:feature eval= is active
+ if =:editor format= is enabled, the =ocamlformat= executable is available and + if =:editor format= is enabled, the =ocamlformat= executable is available and
there is an =.ocamlformat= file present then =format-all-buffer= is bound to there is an =.ocamlformat= file present then =format-all-buffer= is bound to

View file

@ -17,7 +17,7 @@
(tuareg-opam-update-env (tuareg-opam-current-compiler)) (tuareg-opam-update-env (tuareg-opam-current-compiler))
;; Spell-check comments ;; Spell-check comments
(when (featurep! :feature spellcheck) (when (featurep! :tools flyspell)
(add-hook 'tuareg-mode-local-vars-hook #'flyspell-prog-mode)) (add-hook 'tuareg-mode-local-vars-hook #'flyspell-prog-mode))
@ -59,7 +59,7 @@
(def-package! flycheck-ocaml (def-package! flycheck-ocaml
:when (featurep! :feature syntax-checker) :when (featurep! :tools flycheck)
:init :init
(defun +ocaml|init-flycheck () (defun +ocaml|init-flycheck ()
"Activate `flycheck-ocaml` if the current project possesses a .merlin file." "Activate `flycheck-ocaml` if the current project possesses a .merlin file."

View file

@ -6,7 +6,7 @@
(package! merlin-eldoc) (package! merlin-eldoc)
(package! ocp-indent) (package! ocp-indent)
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(package! flycheck-ocaml)) (package! flycheck-ocaml))
(when (featurep! :feature eval) (when (featurep! :feature eval)

View file

@ -6,5 +6,5 @@
(def-package! flycheck-perl6 (def-package! flycheck-perl6
:when (featurep! :feature syntax-checker) :when (featurep! :tools flycheck)
:after perl6-mode) :after perl6-mode)

View file

@ -3,5 +3,5 @@
(package! perl6-mode) (package! perl6-mode)
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(package! flycheck-perl6)) (package! flycheck-perl6))

View file

@ -10,6 +10,6 @@
(def-package! flycheck-plantuml (def-package! flycheck-plantuml
:when (featurep! :feature syntax-checker) :when (featurep! :tools flycheck)
:after plantuml-mode :after plantuml-mode
:config (flycheck-plantuml-setup)) :config (flycheck-plantuml-setup))

View file

@ -2,5 +2,5 @@
;;; lang/plantuml/packages.el ;;; lang/plantuml/packages.el
(package! plantuml-mode) (package! plantuml-mode)
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(package! flycheck-plantuml)) (package! flycheck-plantuml))

View file

@ -28,6 +28,6 @@
(def-package! flycheck-rust (def-package! flycheck-rust
:when (featurep! :feature syntax-checker) :when (featurep! :tools flycheck)
:after rust-mode :after rust-mode
:config (add-hook 'rust-mode-hook #'flycheck-rust-setup)) :config (add-hook 'rust-mode-hook #'flycheck-rust-setup))

View file

@ -6,5 +6,5 @@
(package! racer) (package! racer)
(package! rust-mode) (package! rust-mode)
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(package! flycheck-rust)) (package! flycheck-rust))

View file

@ -8,7 +8,7 @@
(def-package! solidity-flycheck ; included with solidity-mode (def-package! solidity-flycheck ; included with solidity-mode
:when (featurep! :feature syntax-checker) :when (featurep! :tools flycheck)
:after solidity-mode :after solidity-mode
:config :config
(setq flycheck-solidity-solc-addstd-contracts t) (setq flycheck-solidity-solc-addstd-contracts t)

View file

@ -5,7 +5,7 @@
(def-package! flycheck-swift (def-package! flycheck-swift
:when (and (featurep! :feature syntax-checker) :when (and (featurep! :tools flycheck)
(not (featurep! +lsp))) (not (featurep! +lsp)))
:after swift-mode :after swift-mode
:config (flycheck-swift-setup)) :config (flycheck-swift-setup))

View file

@ -7,5 +7,5 @@
(package! lsp-sourcekit) (package! lsp-sourcekit)
(when (featurep! :completion company) (when (featurep! :completion company)
(package! company-sourcekit)) (package! company-sourcekit))
(when (featurep! :feature syntax-checker) (when (featurep! :tools flycheck)
(package! flycheck-swift))) (package! flycheck-swift)))

View file

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

View file

@ -1,20 +1,27 @@
;;; feature/syntax-checker/config.el -*- lexical-binding: t; -*- ;;; 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 (def-package! flycheck
:commands (flycheck-list-errors flycheck-buffer) :commands (flycheck-list-errors flycheck-buffer)
:after-call (doom-enter-buffer-hook after-find-file) :after-call (doom-enter-buffer-hook after-find-file)
:config :config
;; Emacs feels snappier without checks on newline ;; Emacs feels snappier without checks on newline
(setq flycheck-check-syntax-automatically '(save idle-change mode-enabled)) (setq flycheck-check-syntax-automatically (delq 'new-line flycheck-check-syntax-automatically))
(after! evil (defun +flycheck|buffer ()
(defun +syntax-checkers|flycheck-buffer ()
"Flycheck buffer on ESC in normal mode." "Flycheck buffer on ESC in normal mode."
(when flycheck-mode (when (and flycheck-mode +flycheck-on-escape)
(ignore-errors (flycheck-buffer)) (ignore-errors (flycheck-buffer))
nil)) nil))
(add-hook 'doom-escape-hook #'+syntax-checkers|flycheck-buffer t) (add-hook 'doom-escape-hook #'+flycheck|buffer t)
(after! evil
(setq-hook! 'evil-insert-state-entry-hook (setq-hook! 'evil-insert-state-entry-hook
flycheck-idle-change-delay 1.75) flycheck-idle-change-delay 1.75)
(setq-hook! 'evil-insert-state-exit-hook (setq-hook! 'evil-insert-state-exit-hook
@ -25,7 +32,7 @@
(def-package! flycheck-popup-tip (def-package! flycheck-popup-tip
:commands (flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup) :commands (flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup)
:init (add-hook 'flycheck-mode-hook #'+syntax-checker-popup-mode) :init (add-hook 'flycheck-mode-hook #'+flycheck-popup-mode)
:config (setq flycheck-popup-tip-error-prefix "")) :config (setq flycheck-popup-tip-error-prefix ""))

View file

@ -1,5 +1,5 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; feature/syntax-checker/packages.el ;;; tools/flycheck/packages.el
(package! flycheck) (package! flycheck)
(package! flycheck-popup-tip) (package! flycheck-popup-tip)

View file

@ -0,0 +1,69 @@
;;; tools/flyspell/config.el -*- lexical-binding: t; -*-
(defvar-local +flyspell-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 +flyspell-immediately nil)")
;;
;; Packages
(after! ispell
(setq-default ispell-dictionary "english")
(cond ((executable-find "aspell")
(setq ispell-program-name "aspell"
ispell-extra-args '("--sug-mode=ultra" "--run-together"))
(setq-hook! 'text-mode-hook
ispell-extra-args (remove "--run-together" ispell-extra-args)))
((executable-find "hunspell")
(setq ispell-program-name "hunspell"
;; Don't use `ispell-cmd-args', it isn't respected with hunspell.
;; Hack ispell-local-dictionary-alist instead.
ispell-dictionary-alist
`((,ispell-local-dictionary
"[[:alpha:]]"
"[^[:alpha:]]"
"[']"
nil
("-d" ,ispell-local-dictionary)
nil
utf-8)))))
(add-to-list 'ispell-extra-args "--dont-tex-check-comments")
(defun +flyspell*setup-ispell-extra-args (orig-fun &rest args)
(let ((ispell-extra-args (remove "--run-together" ispell-extra-args)))
(ispell-kill-ispell t)
(apply orig-fun args)
(ispell-kill-ispell t)))
(advice-add #'ispell-word :around #'+flyspell*setup-ispell-extra-args)
(advice-add #'flyspell-auto-correct-word :around #'+flyspell*setup-ispell-extra-args))
;; `flyspell' (built-in)
(setq flyspell-issue-welcome-flag nil)
(defun +flyspell|immediately ()
"Spellcheck the buffer when `flyspell-mode' is enabled."
(when (and flyspell-mode +flyspell-immediately)
(flyspell-buffer)))
(add-hook 'flyspell-mode-hook #'+flyspell|immediately)
(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))))

View file

@ -1,5 +1,5 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; feature/spellcheck/packages.el ;;; tools/flyspell/packages.el
(package! flyspell-correct) (package! flyspell-correct)
(cond ((featurep! :completion ivy) (cond ((featurep! :completion ivy)
@ -7,4 +7,3 @@
((featurep! :completion helm) ((featurep! :completion helm)
(package! flyspell-correct-helm)) (package! flyspell-correct-helm))
((package! flyspell-correct-popup))) ((package! flyspell-correct-popup)))