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
|
@ -12,7 +12,9 @@
|
|||
"A list of module root directories. Order determines priority.")
|
||||
|
||||
(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)))
|
||||
(:emacs (electric-indent (:emacs electric))
|
||||
(hideshow (:editor fold))))
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
(lookup ; helps you navigate your code and documentation
|
||||
+docsets) ; ...or in Dash docsets locally
|
||||
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
|
||||
|
||||
:completion
|
||||
|
@ -66,6 +64,8 @@
|
|||
;;docker
|
||||
;;editorconfig ; let someone else argue about tabs vs spaces
|
||||
;;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
|
||||
;;lsp
|
||||
;;macos ; MacOS-specific commands
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
(defun +email*refresh (&rest _) (mu4e-headers-rerun-search))
|
||||
(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))
|
||||
|
||||
;; Wrap text in messages
|
||||
|
|
|
@ -190,7 +190,7 @@ playback.")
|
|||
(define-key lui-mode-map "\C-u" #'lui-kill-to-beginning-of-line)
|
||||
(setq lui-fill-type nil)
|
||||
|
||||
(when (featurep! :feature spellcheck)
|
||||
(when (featurep! :tools flyspell)
|
||||
(setq lui-flyspell-p t))
|
||||
|
||||
(after! evil
|
||||
|
|
|
@ -215,14 +215,14 @@
|
|||
[backspace] #'+snippets/delete-backward-char
|
||||
[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-previous-word-generic
|
||||
(:map flyspell-mouse-map
|
||||
"RET" #'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" #'previous-error
|
||||
(:after flycheck
|
||||
|
|
|
@ -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))))
|
|
@ -146,7 +146,7 @@ compilation database is present in the project.")
|
|||
:hook (irony-mode . irony-eldoc))
|
||||
|
||||
(def-package! flycheck-irony
|
||||
:when (featurep! :feature syntax-checker)
|
||||
:when (featurep! :tools flycheck)
|
||||
:config (flycheck-irony-setup))
|
||||
|
||||
(def-package! company-irony
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
(package! cquery)
|
||||
(when (package! irony)
|
||||
(package! irony-eldoc)
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-irony))
|
||||
(when (featurep! :completion company)
|
||||
(package! company-irony)
|
||||
|
|
|
@ -106,5 +106,5 @@
|
|||
:desc "refactor" "R" #'hydra-cljr-help-menu/body))
|
||||
|
||||
(def-package! flycheck-joker
|
||||
:when (featurep! :feature syntax-checker)
|
||||
:when (featurep! :tools flycheck)
|
||||
:after flycheck))
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
(package! cider)
|
||||
(package! clj-refactor)
|
||||
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-joker))
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
|
||||
(def-package! flycheck-crystal
|
||||
:when (featurep! :feature syntax-checker)
|
||||
:when (featurep! :tools flycheck)
|
||||
:after crystal-mode)
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
(remove-hook 'alchemist-iex-mode-hook fn)))
|
||||
|
||||
(def-package! flycheck-credo
|
||||
:when (featurep! :feature syntax-checker)
|
||||
:when (featurep! :tools flycheck)
|
||||
:config (flycheck-credo-setup)))
|
||||
|
||||
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
;; +elixir.el
|
||||
(package! elixir-mode)
|
||||
(package! alchemist)
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-credo))
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
|
||||
(def-package! flycheck-elm
|
||||
:when (featurep! :feature syntax-checker)
|
||||
:when (featurep! :tools flycheck)
|
||||
:after elm-mode
|
||||
:config (add-to-list 'flycheck-checkers 'elm nil #'eq))
|
||||
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
;;; lang/elm/packages.el
|
||||
|
||||
(package! elm-mode)
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-elm))
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
|
||||
|
||||
(def-package! flycheck-cask
|
||||
:when (featurep! :feature syntax-checker)
|
||||
:when (featurep! :tools flycheck)
|
||||
:defer t
|
||||
:init
|
||||
(add-hook! 'emacs-lisp-mode-hook
|
||||
|
|
|
@ -7,5 +7,5 @@
|
|||
(package! overseer)
|
||||
(package! elisp-def)
|
||||
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-cask))
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
|
||||
(def-package! flycheck-rebar3
|
||||
:when (featurep! :feature syntax-checker)
|
||||
:when (featurep! :tools flycheck)
|
||||
:after flycheck
|
||||
:config (flycheck-rebar3-setup))
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
(package! erlang)
|
||||
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-rebar3))
|
||||
|
||||
(when (featurep! :completion ivy)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"-fdefer-typed-holes"
|
||||
"-fdefer-type-errors"))
|
||||
:config
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(flycheck-add-next-checker 'haskell-dante '(warning . haskell-hlint)))
|
||||
|
||||
(set-company-backend! 'dante-mode #'dante-company)
|
||||
|
|
|
@ -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")
|
||||
(set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition)
|
||||
(set-company-backend! 'intero-mode 'intero-company)
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(flycheck-add-next-checker 'intero '(warning . haskell-hlint)))
|
||||
|
||||
(when (featurep 'evil)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
(after! haskell-mode
|
||||
(setq haskell-process-suggest-remove-import-lines t ; warnings for redundant imports etc
|
||||
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
|
||||
(add-hook! 'haskell-mode-hook
|
||||
#'(haskell-collapse-mode ; support folding haskell code blocks
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
:init
|
||||
(setq meghanada-server-install-dir (concat doom-etc-dir "meghanada-server/")
|
||||
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-auto-start t)
|
||||
:config
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
(add-to-list 'magic-mode-alist '(+javascript-jsx-file-p . rjsx-mode))
|
||||
:config
|
||||
(set-electric! 'rjsx-mode :chars '(?\} ?\) ?. ?>))
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(add-hook! 'rjsx-mode-hook
|
||||
;; jshint doesn't know how to deal with jsx
|
||||
(push 'javascript-jshint flycheck-disabled-checkers)))
|
||||
|
|
|
@ -65,7 +65,7 @@ If no viewers are found, `latex-preview-pane' is used.")
|
|||
'local))
|
||||
;; Enable rainbow mode after applying styles to the buffer
|
||||
(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))
|
||||
;; All these excess pairs dramatically slow down typing in latex buffers, so
|
||||
;; we remove them. Let snippets do their job.
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
|
||||
(def-package! flycheck-ledger
|
||||
:when (featurep! :feature syntax-checker)
|
||||
:when (featurep! :tools flycheck)
|
||||
:after ledger-mode)
|
||||
|
||||
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
(when (featurep! :feature evil)
|
||||
(package! evil-ledger))
|
||||
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-ledger))
|
||||
|
|
|
@ -37,6 +37,6 @@ windows."
|
|||
|
||||
|
||||
(def-package! flycheck-nim
|
||||
:when (featurep! :feature syntax-checker)
|
||||
:when (featurep! :tools flycheck)
|
||||
:after nim-mode)
|
||||
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
|
||||
(package! nim-mode)
|
||||
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-nim))
|
||||
|
|
|
@ -50,10 +50,10 @@ opam install merlin utop ocp-indent dune ocamlformat
|
|||
|
||||
* Configuration
|
||||
+ if =:completion company= is enabled then autocomplete is provided by =merlin=
|
||||
+ when =:feature syntax-checker= is enabled then =flycheck-ocaml= is activated
|
||||
to do on-the-fly syntax/type checking via =merlin=, otherwise this is only
|
||||
done when the file is saved.
|
||||
+ spell checking is activated in comments if =:feature spellcheck= is active
|
||||
+ when =:tools flycheck= is enabled then =flycheck-ocaml= is activated to do
|
||||
on-the-fly syntax/type checking via =merlin=, otherwise this is only done when
|
||||
the file is saved.
|
||||
+ spell checking is activated in comments if =:tools flyspell= 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
|
||||
there is an =.ocamlformat= file present then =format-all-buffer= is bound to
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
(tuareg-opam-update-env (tuareg-opam-current-compiler))
|
||||
|
||||
;; Spell-check comments
|
||||
(when (featurep! :feature spellcheck)
|
||||
(when (featurep! :tools flyspell)
|
||||
(add-hook 'tuareg-mode-local-vars-hook #'flyspell-prog-mode))
|
||||
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
|||
|
||||
|
||||
(def-package! flycheck-ocaml
|
||||
:when (featurep! :feature syntax-checker)
|
||||
:when (featurep! :tools flycheck)
|
||||
:init
|
||||
(defun +ocaml|init-flycheck ()
|
||||
"Activate `flycheck-ocaml` if the current project possesses a .merlin file."
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
(package! merlin-eldoc)
|
||||
(package! ocp-indent)
|
||||
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-ocaml))
|
||||
|
||||
(when (featurep! :feature eval)
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
|
||||
|
||||
(def-package! flycheck-perl6
|
||||
:when (featurep! :feature syntax-checker)
|
||||
:when (featurep! :tools flycheck)
|
||||
:after perl6-mode)
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
|
||||
(package! perl6-mode)
|
||||
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-perl6))
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
|
||||
(def-package! flycheck-plantuml
|
||||
:when (featurep! :feature syntax-checker)
|
||||
:when (featurep! :tools flycheck)
|
||||
:after plantuml-mode
|
||||
:config (flycheck-plantuml-setup))
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
;;; lang/plantuml/packages.el
|
||||
|
||||
(package! plantuml-mode)
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-plantuml))
|
||||
|
|
|
@ -28,6 +28,6 @@
|
|||
|
||||
|
||||
(def-package! flycheck-rust
|
||||
:when (featurep! :feature syntax-checker)
|
||||
:when (featurep! :tools flycheck)
|
||||
:after rust-mode
|
||||
:config (add-hook 'rust-mode-hook #'flycheck-rust-setup))
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
(package! racer)
|
||||
(package! rust-mode)
|
||||
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-rust))
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
|
||||
(def-package! solidity-flycheck ; included with solidity-mode
|
||||
:when (featurep! :feature syntax-checker)
|
||||
:when (featurep! :tools flycheck)
|
||||
:after solidity-mode
|
||||
:config
|
||||
(setq flycheck-solidity-solc-addstd-contracts t)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
|
||||
(def-package! flycheck-swift
|
||||
:when (and (featurep! :feature syntax-checker)
|
||||
:when (and (featurep! :tools flycheck)
|
||||
(not (featurep! +lsp)))
|
||||
:after swift-mode
|
||||
:config (flycheck-swift-setup))
|
||||
|
|
|
@ -7,5 +7,5 @@
|
|||
(package! lsp-sourcekit)
|
||||
(when (featurep! :completion company)
|
||||
(package! company-sourcekit))
|
||||
(when (featurep! :feature syntax-checker)
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-swift)))
|
||||
|
|
|
@ -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"
|
||||
(if (and EMACS26+
|
||||
(featurep! +childframe)
|
||||
|
@ -8,13 +8,13 @@
|
|||
(flycheck-posframe-show-posframe errors)
|
||||
(flycheck-popup-tip-show-popup errors)))
|
||||
|
||||
(defun +syntax-checker-cleanup-popup ()
|
||||
(defun +flycheck-cleanup-popup ()
|
||||
"TODO"
|
||||
(when (display-graphic-p)
|
||||
(flycheck-popup-tip-delete-popup)))
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode +syntax-checker-popup-mode
|
||||
(define-minor-mode +flycheck-popup-mode
|
||||
"TODO"
|
||||
:lighter nil
|
||||
:group 'doom
|
||||
|
@ -23,22 +23,22 @@
|
|||
(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
|
||||
((and +flycheck-popup-mode
|
||||
(not (eq flycheck-display-errors-function
|
||||
#'+syntax-checker-show-popup)))
|
||||
#'+flycheck-show-popup)))
|
||||
(setq flycheck-popup-tip-old-display-function
|
||||
flycheck-display-errors-function
|
||||
flycheck-display-errors-function
|
||||
#'+syntax-checker-show-popup)
|
||||
#'+flycheck-show-popup)
|
||||
(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
|
||||
;; if the mode is still active.
|
||||
((and (not +syntax-checker-popup-mode)
|
||||
((and (not +flycheck-popup-mode)
|
||||
(eq flycheck-display-errors-function
|
||||
#'+syntax-checker-show-popup))
|
||||
#'+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 '+syntax-checker-cleanup-popup t))))))
|
||||
(remove-hook hook '+flycheck-cleanup-popup t))))))
|
|
@ -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
|
||||
: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))
|
||||
(setq flycheck-check-syntax-automatically (delq 'new-line flycheck-check-syntax-automatically))
|
||||
|
||||
(after! evil
|
||||
(defun +syntax-checkers|flycheck-buffer ()
|
||||
(defun +flycheck|buffer ()
|
||||
"Flycheck buffer on ESC in normal mode."
|
||||
(when flycheck-mode
|
||||
(when (and flycheck-mode +flycheck-on-escape)
|
||||
(ignore-errors (flycheck-buffer))
|
||||
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
|
||||
flycheck-idle-change-delay 1.75)
|
||||
(setq-hook! 'evil-insert-state-exit-hook
|
||||
|
@ -25,7 +32,7 @@
|
|||
|
||||
(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)
|
||||
:init (add-hook 'flycheck-mode-hook #'+flycheck-popup-mode)
|
||||
:config (setq flycheck-popup-tip-error-prefix "✕ "))
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; feature/syntax-checker/packages.el
|
||||
;;; tools/flycheck/packages.el
|
||||
|
||||
(package! flycheck)
|
||||
(package! flycheck-popup-tip)
|
69
modules/tools/flyspell/config.el
Normal file
69
modules/tools/flyspell/config.el
Normal 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))))
|
|
@ -1,5 +1,5 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; feature/spellcheck/packages.el
|
||||
;;; tools/flyspell/packages.el
|
||||
|
||||
(package! flyspell-correct)
|
||||
(cond ((featurep! :completion ivy)
|
||||
|
@ -7,4 +7,3 @@
|
|||
((featurep! :completion helm)
|
||||
(package! flyspell-correct-helm))
|
||||
((package! flyspell-correct-popup)))
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue