d12frosted / flyspell-correct

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

rapid mode #45

Closed Ergus closed 4 years ago

Ergus commented 5 years ago

Hi I am using the Ivy interface and after the configuration I was not having the rapid behaviour with C-u. I Changed the code in the wrapper to make it simpler and now it works. The problem is that the prefix was not passed among the functions.

;;;###autoload
(defun flyspell-correct-wrapper (arg)
  (interactive "P")
  (if (or (not (mark)) (/= (mark) (point)))
      (push-mark (point) t))
  (let ((flyspell-forward-direction t)
        (flyspell-rapid nil))
  (cond
   ((equal current-prefix-arg '(4)) ; C-u = rapid
    (setq flyspell-rapid t))
   ((equal current-prefix-arg '(16))    ; C-u C-u = change direction
    (setq flyspell-forward-direction nil))
   ((equal current-prefix-arg '(64))    ; C-u C-u C-u = do both
    (setq flyspell-rapid t)
    (setq flyspell-forward-direction nil)))
  (flyspell-correct-move (point) flyspell-forward-direction flyspell-rapid)))
d12frosted commented 5 years ago

Hi Ergus,

Thank you for checking this feature out. I am not sure why current-prefix-arg didn't work for you, but I like how you refactored that function, so I would be happy to get a PR (or a patch via email if it's more suitable for you), so I can apply it. Anyway, kudos for digging this out! 💯

Boruch-Baum commented 5 years ago

Shouldn't this be closed, due to https://github.com/d12frosted/flyspell-correct/pull/46 ? Curious all this, because I've been using ivy since when I wrote my version of the code, it has always been working. @d12frosted - Hi! I'm now updating and merging your work into my version, and will post comments separately.