d12frosted / flyspell-correct

Distraction-free words correction with flyspell via selected interface.
Other
203 stars 14 forks source link

Setup using use-package #75

Closed tpadioleau closed 4 years ago

tpadioleau commented 4 years ago

Hi,

I tried to use flyspell-correct-helm flavor using the setup you propose

(use-package flyspell-correct-helm
  :bind ("C-;" . flyspell-correct-wrapper)
  :init
  (setq flyspell-correct-interface #'flyspell-correct-helm))

It doesn't seem to work for me. The key binding is not set, it is actually still bound to flyspell-auto-correct-previous-word. Moreover if I use manually the flyspell-correct-wrapper function, it complains saying helm-M-x-execute-command: Symbol’s function definition is void: flyspell-correct-helm.

The simpler setup you suggest

(require 'flyspell-correct-helm)
(define-key flyspell-mode-map (kbd "C-;") 'flyspell-correct-wrapper)

is working for me (key binding and it uses helm version). But I notice that it doesn't seem to do operations in the same order as in the use-package setup.

I think there are two problems with the use-package setup:

(use-package flyspell-correct-helm :after flyspell-correct)


This way `flyspell-correct-helm` is loaded as soon as `flyspell-correct` is, for example when `C-;` is pressed. `(setq flyspell-correct-interface #'flyspell-correct-helm)` doesn't seem needed because it is already in `flyspell-correct-helm.el`. Finally if one doesn't want to use a key-binding, it can be replaced by explicitly deferring with `:defer t`.

Thanks
d12frosted commented 4 years ago

Hey @tpadioleau

Thank you very much for your feedback and for time you spent digging into it! In my own configurations I am also split flyspell-correct and flyspell-correct-<interface> configurations, because it makes sense to.

I would gladly accept PR improving documentation.

d12frosted commented 4 years ago

Fixed via #76