flyspell correct the previous to previous mistake

371 views Asked by At

suppose I have buffer contents as follows

teh msot |

curser is at |. generally I can correct msot to most with single C-; press (flyspell-auto-correct-previous-word). What I want is to correct teh to the, i.e previous to previous mistake. (or in general nth spell)

It seems flyspell-auto-correct-previous-word is taking numerical argument but not yielding intended result.

what am I missing.?

UPDATE:

Why I need this., when I write research notes, flyspell mistakenly marks some scientific words wrong. So need to skip the one or two false marks.

1

There are 1 answers

2
Matthias On

C-h f flyspell-auto-correct-previous-word tells me that the numerical argument is called "position". That does not look like what you are looking for. Position is likely to refer to a position in the buffer. Looking at the flyspell sourcecode reveals that the parameter is not used in the intendet way (cant tell what an overlay is thoug...)

;*---------------------------------------------------------------------*/
;*    flyspell-auto-correct-previous-word ...                          */
;*---------------------------------------------------------------------*/
(defun flyspell-auto-correct-previous-word (position) 
  "*Auto correct the first mispelled word that occurs before point."
  (interactive "d")

  (add-hook 'pre-command-hook 
        (function flyspell-auto-correct-previous-hook) t t)

  (save-excursion
    (unless flyspell-auto-correct-previous-pos
      ;; only reset if a new overlay exists
      (setq flyspell-auto-correct-previous-pos nil)

      (let ((overlay-list (overlays-in (point-min) position))
        (new-overlay 'dummy-value))
[SNIP]

also the (interactive "d") shows that the current position of point is assigned to position in case of an interactive call. matthias