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.
Asked
Active
Viewed 148 times
2 Answers
1
I looked through the (defun flyspell-auto-correct-word ...)
and I can't see any good hooks or other customization points there so I think your best bet is to use C-h f defadvice
:
(defadvice flyspell-auto-correct-word (after flyspell-forward-word activate) (flyspell-goto-next-error))

Ross Patterson
- 5,702
- 20
- 38
-
Yes I knew how to do this but the issue is the command doesn't operate properly anymore because it cancels the flyspell-auto-correct-word with the forward-word command. You can't repeatedly cycle through the words with this. Have to do the command twice everytime. I guess if there are no hooks or customization points it is the only way. That is what I wasn't sure of. It's nearly always the first word but just thought there might be a way to get it to work properly. I actually just use way but thanks for the defadvice tip. – J Spen Sep 08 '11 at 11:47
-
Ah, yeah, well there's no way around that by definition. You have `C-.` for trying the next correction and `C-,` for jumping to the next mispelling but there's no `C-
` :-) – Ross Patterson Sep 08 '11 at 12:23 -
Yeah I get ya :). I guess it needs to be programmed into the flyspell package which is beyond me so I'll live with it. Nearly always the first word when I want to use it anyway. Thanks for the help though. – J Spen Sep 08 '11 at 13:11
-
No, how *could* it be programmed *anywhere*. If two different things need to be done and it's impossible for the software to know which should be done, then soliciting user input (such as having two different commands bound to two different keys) is the *only* way this *can* be done. – Ross Patterson Sep 08 '11 at 18:20
-
Not really sure you understood what I was asking but check Trey Jackson's answer because does exactly as I was asking. Moves the cursor to the end of the word after the change of word. Instead of leaving the cursor in place no matter the length of the word. Also keeps the flyspell command intact so you can keep cycling through repeatedly. – J Spen Sep 09 '11 at 12:16
1
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.

Trey Jackson
- 73,529
- 11
- 197
- 229