emacselispauctexispellflyspell

Force flyspell to go to the end of the word when autocorrecting word in Emacs


I have found it annoying that flyspell seems to stay in the middle of the word when you do flyspell-auto-correct-word command. Can this be changed to force it to go to the end of the word after running the command? It might be as simple as setting a key binding to auto-complete-word and then move-forward-word which I know how to do. But this won't work in all cases because sometimes it puts the cursor behind the word if the auto-complete word was smaller than the typed word. Any help on this would be great.


Solution

  • Try this code:

    (eval-after-load "flyspell"
      '(defun flyspell-ajust-cursor-point (save cursor-location old-max)
         (when (not (looking-at "\\b"))
           (forward-word))))
    

    Tested with flyspell version 1.7k, and with the version shipped with Emacs 23.2.