diff --git a/core/core-modules.el b/core/core-modules.el index 11248578f..3007460cc 100644 --- a/core/core-modules.el +++ b/core/core-modules.el @@ -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)))) diff --git a/init.example.el b/init.example.el index 38c9b35a0..08180c997 100644 --- a/init.example.el +++ b/init.example.el @@ -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 diff --git a/modules/app/email/config.el b/modules/app/email/config.el index 4a59d9648..3b8f4b556 100644 --- a/modules/app/email/config.el +++ b/modules/app/email/config.el @@ -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 diff --git a/modules/app/irc/config.el b/modules/app/irc/config.el index 901d45d59..34be5d598 100644 --- a/modules/app/irc/config.el +++ b/modules/app/irc/config.el @@ -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 diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index e625846b2..dd216510a 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -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 diff --git a/modules/feature/spellcheck/config.el b/modules/feature/spellcheck/config.el deleted file mode 100644 index 40cb910f5..000000000 --- a/modules/feature/spellcheck/config.el +++ /dev/null @@ -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)))) diff --git a/modules/lang/cc/config.el b/modules/lang/cc/config.el index 53488b288..f0535061c 100644 --- a/modules/lang/cc/config.el +++ b/modules/lang/cc/config.el @@ -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 diff --git a/modules/lang/cc/packages.el b/modules/lang/cc/packages.el index cdb6d85d5..d0213da5c 100644 --- a/modules/lang/cc/packages.el +++ b/modules/lang/cc/packages.el @@ -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) diff --git a/modules/lang/clojure/config.el b/modules/lang/clojure/config.el index 5ddf6850c..ab6d8823b 100644 --- a/modules/lang/clojure/config.el +++ b/modules/lang/clojure/config.el @@ -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)) diff --git a/modules/lang/clojure/packages.el b/modules/lang/clojure/packages.el index 1f62de5fc..e289c1e81 100644 --- a/modules/lang/clojure/packages.el +++ b/modules/lang/clojure/packages.el @@ -4,5 +4,5 @@ (package! cider) (package! clj-refactor) -(when (featurep! :feature syntax-checker) +(when (featurep! :tools flycheck) (package! flycheck-joker)) diff --git a/modules/lang/crystal/config.el b/modules/lang/crystal/config.el index ac221d42a..dc38bc408 100644 --- a/modules/lang/crystal/config.el +++ b/modules/lang/crystal/config.el @@ -13,7 +13,7 @@ (def-package! flycheck-crystal - :when (featurep! :feature syntax-checker) + :when (featurep! :tools flycheck) :after crystal-mode) diff --git a/modules/lang/elixir/config.el b/modules/lang/elixir/config.el index f57442ad0..718dd46e8 100644 --- a/modules/lang/elixir/config.el +++ b/modules/lang/elixir/config.el @@ -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))) diff --git a/modules/lang/elixir/packages.el b/modules/lang/elixir/packages.el index f55347979..a50e54ce7 100644 --- a/modules/lang/elixir/packages.el +++ b/modules/lang/elixir/packages.el @@ -4,5 +4,5 @@ ;; +elixir.el (package! elixir-mode) (package! alchemist) -(when (featurep! :feature syntax-checker) +(when (featurep! :tools flycheck) (package! flycheck-credo)) diff --git a/modules/lang/elm/config.el b/modules/lang/elm/config.el index 572d97cc0..3899a89f9 100644 --- a/modules/lang/elm/config.el +++ b/modules/lang/elm/config.el @@ -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)) diff --git a/modules/lang/elm/packages.el b/modules/lang/elm/packages.el index 78ee898fd..23bf4d45d 100644 --- a/modules/lang/elm/packages.el +++ b/modules/lang/elm/packages.el @@ -2,6 +2,6 @@ ;;; lang/elm/packages.el (package! elm-mode) -(when (featurep! :feature syntax-checker) +(when (featurep! :tools flycheck) (package! flycheck-elm)) diff --git a/modules/lang/emacs-lisp/config.el b/modules/lang/emacs-lisp/config.el index 856a9cb61..a67312d0c 100644 --- a/modules/lang/emacs-lisp/config.el +++ b/modules/lang/emacs-lisp/config.el @@ -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 diff --git a/modules/lang/emacs-lisp/packages.el b/modules/lang/emacs-lisp/packages.el index 12a4d1f24..8bbf4dd3b 100644 --- a/modules/lang/emacs-lisp/packages.el +++ b/modules/lang/emacs-lisp/packages.el @@ -7,5 +7,5 @@ (package! overseer) (package! elisp-def) -(when (featurep! :feature syntax-checker) +(when (featurep! :tools flycheck) (package! flycheck-cask)) diff --git a/modules/lang/erlang/config.el b/modules/lang/erlang/config.el index 1f4a062b8..fbc17bc31 100644 --- a/modules/lang/erlang/config.el +++ b/modules/lang/erlang/config.el @@ -9,7 +9,7 @@ (def-package! flycheck-rebar3 - :when (featurep! :feature syntax-checker) + :when (featurep! :tools flycheck) :after flycheck :config (flycheck-rebar3-setup)) diff --git a/modules/lang/erlang/packages.el b/modules/lang/erlang/packages.el index 79e5b8f65..00a871c99 100644 --- a/modules/lang/erlang/packages.el +++ b/modules/lang/erlang/packages.el @@ -3,7 +3,7 @@ (package! erlang) -(when (featurep! :feature syntax-checker) +(when (featurep! :tools flycheck) (package! flycheck-rebar3)) (when (featurep! :completion ivy) diff --git a/modules/lang/haskell/+dante.el b/modules/lang/haskell/+dante.el index 8b1f3cb82..44908bc9a 100644 --- a/modules/lang/haskell/+dante.el +++ b/modules/lang/haskell/+dante.el @@ -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) diff --git a/modules/lang/haskell/+intero.el b/modules/lang/haskell/+intero.el index 9f6c3b4cf..1ba04599d 100644 --- a/modules/lang/haskell/+intero.el +++ b/modules/lang/haskell/+intero.el @@ -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) diff --git a/modules/lang/haskell/config.el b/modules/lang/haskell/config.el index 836475a33..aedfce663 100644 --- a/modules/lang/haskell/config.el +++ b/modules/lang/haskell/config.el @@ -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 diff --git a/modules/lang/java/+meghanada.el b/modules/lang/java/+meghanada.el index 0a0aa74f7..e422deb9b 100644 --- a/modules/lang/java/+meghanada.el +++ b/modules/lang/java/+meghanada.el @@ -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 diff --git a/modules/lang/javascript/config.el b/modules/lang/javascript/config.el index 31b4804e5..e77d90987 100644 --- a/modules/lang/javascript/config.el +++ b/modules/lang/javascript/config.el @@ -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))) diff --git a/modules/lang/latex/config.el b/modules/lang/latex/config.el index 45b29a792..b5ffb5ada 100644 --- a/modules/lang/latex/config.el +++ b/modules/lang/latex/config.el @@ -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. diff --git a/modules/lang/ledger/config.el b/modules/lang/ledger/config.el index a5ec20d0f..26fd8c4b8 100644 --- a/modules/lang/ledger/config.el +++ b/modules/lang/ledger/config.el @@ -21,7 +21,7 @@ (def-package! flycheck-ledger - :when (featurep! :feature syntax-checker) + :when (featurep! :tools flycheck) :after ledger-mode) diff --git a/modules/lang/ledger/packages.el b/modules/lang/ledger/packages.el index b58a40382..4661ee7a8 100644 --- a/modules/lang/ledger/packages.el +++ b/modules/lang/ledger/packages.el @@ -6,5 +6,5 @@ (when (featurep! :feature evil) (package! evil-ledger)) -(when (featurep! :feature syntax-checker) +(when (featurep! :tools flycheck) (package! flycheck-ledger)) diff --git a/modules/lang/nim/config.el b/modules/lang/nim/config.el index f5f960467..2f6680694 100644 --- a/modules/lang/nim/config.el +++ b/modules/lang/nim/config.el @@ -37,6 +37,6 @@ windows." (def-package! flycheck-nim - :when (featurep! :feature syntax-checker) + :when (featurep! :tools flycheck) :after nim-mode) diff --git a/modules/lang/nim/packages.el b/modules/lang/nim/packages.el index f8453e807..ba994148a 100644 --- a/modules/lang/nim/packages.el +++ b/modules/lang/nim/packages.el @@ -5,5 +5,5 @@ (package! nim-mode) -(when (featurep! :feature syntax-checker) +(when (featurep! :tools flycheck) (package! flycheck-nim)) diff --git a/modules/lang/ocaml/README.org b/modules/lang/ocaml/README.org index 9154077b8..1ba199387 100644 --- a/modules/lang/ocaml/README.org +++ b/modules/lang/ocaml/README.org @@ -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 diff --git a/modules/lang/ocaml/config.el b/modules/lang/ocaml/config.el index 87445332c..9a4a173b3 100644 --- a/modules/lang/ocaml/config.el +++ b/modules/lang/ocaml/config.el @@ -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." diff --git a/modules/lang/ocaml/packages.el b/modules/lang/ocaml/packages.el index 71128923f..748274499 100644 --- a/modules/lang/ocaml/packages.el +++ b/modules/lang/ocaml/packages.el @@ -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) diff --git a/modules/lang/perl/config.el b/modules/lang/perl/config.el index 9a7f4ad1b..e0768b554 100644 --- a/modules/lang/perl/config.el +++ b/modules/lang/perl/config.el @@ -6,5 +6,5 @@ (def-package! flycheck-perl6 - :when (featurep! :feature syntax-checker) + :when (featurep! :tools flycheck) :after perl6-mode) diff --git a/modules/lang/perl/packages.el b/modules/lang/perl/packages.el index a87fd4b8e..e00de4f19 100644 --- a/modules/lang/perl/packages.el +++ b/modules/lang/perl/packages.el @@ -3,5 +3,5 @@ (package! perl6-mode) -(when (featurep! :feature syntax-checker) +(when (featurep! :tools flycheck) (package! flycheck-perl6)) diff --git a/modules/lang/plantuml/config.el b/modules/lang/plantuml/config.el index 04001c496..f32ba72b1 100644 --- a/modules/lang/plantuml/config.el +++ b/modules/lang/plantuml/config.el @@ -10,6 +10,6 @@ (def-package! flycheck-plantuml - :when (featurep! :feature syntax-checker) + :when (featurep! :tools flycheck) :after plantuml-mode :config (flycheck-plantuml-setup)) diff --git a/modules/lang/plantuml/packages.el b/modules/lang/plantuml/packages.el index f83696e6c..0335841a7 100644 --- a/modules/lang/plantuml/packages.el +++ b/modules/lang/plantuml/packages.el @@ -2,5 +2,5 @@ ;;; lang/plantuml/packages.el (package! plantuml-mode) -(when (featurep! :feature syntax-checker) +(when (featurep! :tools flycheck) (package! flycheck-plantuml)) diff --git a/modules/lang/rust/config.el b/modules/lang/rust/config.el index ff32dd429..67eac44f8 100644 --- a/modules/lang/rust/config.el +++ b/modules/lang/rust/config.el @@ -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)) diff --git a/modules/lang/rust/packages.el b/modules/lang/rust/packages.el index 12fd7c646..5e8f2f2d1 100644 --- a/modules/lang/rust/packages.el +++ b/modules/lang/rust/packages.el @@ -6,5 +6,5 @@ (package! racer) (package! rust-mode) -(when (featurep! :feature syntax-checker) +(when (featurep! :tools flycheck) (package! flycheck-rust)) diff --git a/modules/lang/solidity/config.el b/modules/lang/solidity/config.el index 0157c37fd..6a4cf3efb 100644 --- a/modules/lang/solidity/config.el +++ b/modules/lang/solidity/config.el @@ -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) diff --git a/modules/lang/swift/config.el b/modules/lang/swift/config.el index a41d85306..ec566c392 100644 --- a/modules/lang/swift/config.el +++ b/modules/lang/swift/config.el @@ -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)) diff --git a/modules/lang/swift/packages.el b/modules/lang/swift/packages.el index baec9033f..6dd3244f0 100644 --- a/modules/lang/swift/packages.el +++ b/modules/lang/swift/packages.el @@ -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))) diff --git a/modules/feature/syntax-checker/autoload.el b/modules/tools/flycheck/autoload.el similarity index 67% rename from modules/feature/syntax-checker/autoload.el rename to modules/tools/flycheck/autoload.el index d0f6b9de2..ccbaa1c94 100644 --- a/modules/feature/syntax-checker/autoload.el +++ b/modules/tools/flycheck/autoload.el @@ -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)))))) diff --git a/modules/feature/syntax-checker/config.el b/modules/tools/flycheck/config.el similarity index 60% rename from modules/feature/syntax-checker/config.el rename to modules/tools/flycheck/config.el index 56714c1bd..0d1cf2af8 100644 --- a/modules/feature/syntax-checker/config.el +++ b/modules/tools/flycheck/config.el @@ -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)) + + (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 - (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 @@ -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 "✕ ")) diff --git a/modules/feature/syntax-checker/packages.el b/modules/tools/flycheck/packages.el similarity index 80% rename from modules/feature/syntax-checker/packages.el rename to modules/tools/flycheck/packages.el index f7144267c..e5e2f0885 100644 --- a/modules/feature/syntax-checker/packages.el +++ b/modules/tools/flycheck/packages.el @@ -1,5 +1,5 @@ ;; -*- no-byte-compile: t; -*- -;;; feature/syntax-checker/packages.el +;;; tools/flycheck/packages.el (package! flycheck) (package! flycheck-popup-tip) diff --git a/modules/tools/flyspell/config.el b/modules/tools/flyspell/config.el new file mode 100644 index 000000000..2b6958c5e --- /dev/null +++ b/modules/tools/flyspell/config.el @@ -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)))) diff --git a/modules/feature/spellcheck/packages.el b/modules/tools/flyspell/packages.el similarity index 87% rename from modules/feature/spellcheck/packages.el rename to modules/tools/flyspell/packages.el index 87e8bd828..efb81d804 100644 --- a/modules/feature/spellcheck/packages.el +++ b/modules/tools/flyspell/packages.el @@ -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))) -