From 2c81ee4d980d3e0cc032f6402fa42e4ccbb21095 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 2 Apr 2019 15:33:03 -0400 Subject: [PATCH] tools/flyspell: minor refactor - Allow flyspell-correct-* packages to be disabled by the end-user without breaking errors. - Tie proselint detection to flycheck (which is what uses it) --- modules/tools/flyspell/config.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/tools/flyspell/config.el b/modules/tools/flyspell/config.el index 1fd57a4e9..2893f0b67 100644 --- a/modules/tools/flyspell/config.el +++ b/modules/tools/flyspell/config.el @@ -64,7 +64,8 @@ Since spellchecking can be slow in some buffers, this can be disabled with: (defun +flyspell|inhibit-duplicate-detection-maybe () "Don't mark duplicates when style/grammar linters are present. e.g. proselint and langtool." - (when (or (executable-find "proselint") + (when (or (and (bound-and-true-p flycheck-mode) + (executable-find "proselint")) (featurep 'langtool)) (setq-local flyspell-mark-duplications-flag nil))) (add-hook 'flyspell-mode-hook #'+flyspell|inhibit-duplicate-detection-maybe) @@ -84,10 +85,10 @@ e.g. proselint and langtool." :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) + (cond ((and (featurep! :completion helm) + (require 'flyspell-correct-helm nil t))) + ((and (featurep! :completion ivy) + (require 'flyspell-correct-ivy nil t))) + ((require 'flyspell-correct-popup nil t) (setq flyspell-popup-correct-delay 0.8) (define-key popup-menu-keymap [escape] #'keyboard-quit))))