diff --git a/CHANGELOG.org b/CHANGELOG.org index 88a6f2a..22b99b2 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -17,6 +17,8 @@ - Rewrite all tests using [[https://github.com/jorgenschaefer/emacs-buttercup][buttercup]] library. - Allow to correct and save the word in one pass (see #66). - New action - =stop= allowing to leave the point at the misspelled word. +- =skip= action now allows to correct 'next' word even if rapid mode is not + enabled (#58). * v0.6.1 diff --git a/flyspell-correct.el b/flyspell-correct.el index 022e0e8..d48651f 100644 --- a/flyspell-correct.el +++ b/flyspell-correct.el @@ -311,9 +311,14 @@ until all errors in buffer have been addressed." hard-move-point t)) ;; break from rapid mode - (when (or (not rapid) - (eq (car-safe res) 'break) - (eq (car-safe res) 'stop)) + (when (or + ;; treat skip as one-time rapid mode enabler + (and (not (eq (car-safe res) 'skip)) + (not rapid)) + + ;; explicit rapid mode disablers + (eq (car-safe res) 'break) + (eq (car-safe res) 'stop)) (setq overlay nil)) ;; push mark diff --git a/test/test-flyspell-correct.el b/test/test-flyspell-correct.el index c401a1a..f62cd01 100644 --- a/test/test-flyspell-correct.el +++ b/test/test-flyspell-correct.el @@ -377,24 +377,41 @@ Simply passed WORD to `correct-word' mock." (with-mistakes|cursor-before (flyspell-correct-next (point)) - (expect-no-correction "versiuns"))) + (expect 'correct-interface :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-with "versiuns") + (expect 'correct-word :to-have-been-called-with "werk") + (expect 'flyspell-do-correct :not :to-have-been-called))) (it "call correct when the cursor is at the beginning of misspelled word" (with-mistakes|cursor-beginning (flyspell-correct-next (point)) - (expect-no-correction "versiuns"))) + + (expect 'correct-interface :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-with "versiuns") + (expect 'correct-word :to-have-been-called-with "werk") + (expect 'flyspell-do-correct :not :to-have-been-called))) (it "call correct when the cursor is inside of misspelled word" (with-mistakes|cursor-inside (flyspell-correct-next (point)) - (expect-no-correction "versiuns"))) + (expect 'correct-interface :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-with "versiuns") + (expect 'correct-word :to-have-been-called-with "werk") + (expect 'flyspell-do-correct :not :to-have-been-called))) (it "call correct when the cursor is at the end of misspelled word" (with-mistakes|cursor-end (flyspell-correct-next (point)) - (expect-no-correction "versiuns")))) + (expect 'correct-interface :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-with "versiuns") + (expect 'correct-word :to-have-been-called-with "werk") + (expect 'flyspell-do-correct :not :to-have-been-called)))) (describe "action - stop" @@ -468,25 +485,41 @@ Simply passed WORD to `correct-word' mock." (with-mistakes|cursor-beginning (flyspell-correct-previous (point)) - (expect-no-correction "versiuns"))) + (expect 'correct-interface :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-with "versiuns") + (expect 'correct-word :to-have-been-called-with "Generel") + (expect 'flyspell-do-correct :not :to-have-been-called))) (it "call correct when the cursor is inside of misspelled word, but skip" (with-mistakes|cursor-inside (flyspell-correct-previous (point)) - (expect-no-correction "versiuns"))) + (expect 'correct-interface :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-with "versiuns") + (expect 'correct-word :to-have-been-called-with "Generel") + (expect 'flyspell-do-correct :not :to-have-been-called))) (it "call correct when the cursor is at the end of misspelled word" (with-mistakes|cursor-end (flyspell-correct-previous (point)) - (expect-no-correction "versiuns"))) + (expect 'correct-interface :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-with "versiuns") + (expect 'correct-word :to-have-been-called-with "Generel") + (expect 'flyspell-do-correct :not :to-have-been-called))) (it "call correct when the cursor is after misspelled word" (with-mistakes|cursor-after (flyspell-correct-previous (point)) - (expect-no-correction "versiuns")))) + (expect 'correct-interface :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-times 2) + (expect 'correct-word :to-have-been-called-with "versiuns") + (expect 'correct-word :to-have-been-called-with "Generel") + (expect 'flyspell-do-correct :not :to-have-been-called)))) (describe "action - stop"