When flyspell-mode is active, typing is somewhat – although barely noticeable – more sluggish than without, also marking of words.

Is it possible to somehow speed up flyspell-mode, maybe make it not check as frequently?

I’m running GNU Emacs 24.5.1 (i686-pc-mingw32) of 2015-04-11 on LEG570 on an Intel Core i3 powered laptop with 8 GiB of RAM. As spell checker, I configured hunspell installed from ezwinports.

Spell checking with speck-mode does not slow down typing, but here I ran into another issue (now fixed).



Besides, you can turn off flyspell-mode completely and use M-x flyspell-buffer instead.

You can also use my package https://github.com/redguardtoo/wucuo

It has two modes (see wucuo-flyspell-start-mode),

  • In "normal" mode, it calls flyspell-buffer to check current buffer when saving file.

  • In "fast" mode, it calls flyspell-region to check the visible region when saving file.

  • 2
    I assigned flyspell-lazy-check-pending to M-q, in addition to fill-paragraph of course. That way, if I fill a paragraph, spelling is triggered instantaneously, i.e. I don’t have to wait for flyspell-lazy. Also, I let flyspell-buffer run when a text file is loaded. – feklee Jul 18 '16 at 9:22
  • How did you let flyspell-buffer run when a text file is loaded? @feklee – alper May 26 '20 at 12:17

Flyspell is unfortunately slow and that is just life when using Emacs. The minor-mode does, however, have a few built-in optimizations that are customizable.

The variables flyspell-default-deplacement-commands and flyspell-deplacement-commands are used to prevent flyspell from checking a word. Essentially, if this-command (the current command) is the same as the previous command (flyspell-previous-command), and this command is a member of the list of deplacement commands, then do not check the word. [The commands in the lists are associated with the symbol flyspell-deplacement and used internally when flyspell decides whether to check a word.]

The variables flyspell-default-delayed-commands and flyspell-delayed-commands are used to delay checking the word for flyspell-delay seconds. [The commands in the lists are associated with the symbol flyspell-delayed and used internally when flyspell decides whether to delay checking a word.]

[When referring to the symbols flyspell-deplacement and flyspell-delayed, they are for internal usage and not meant to be customized by the user.]

  • 1
    I deleted my previous comments because my subsequent testing revealed that flyspell actually handles self-insert-command as well as can be expected with the default value of flyspell-delay being 3 seconds. Try to pinpoint which commands you are executing where the delay is noticeable, and add those functions to one of the lists mentioned in the answer above. The time consuming function is flyspell-word, just in case you wish to add a message for purposes of seeing when it fires while doing your testing -- once your testing is done, you can remove the message. – lawlist Jul 16 '16 at 22:45
  • I now checked in emacs -Q: flyspell-word runs three times when I hit space. This is too often when I’m typing fast! Why flyspell-word runs three time I haven’t yet investigated, but the function is recursive, and so that may be OK. Every time I mark a word using <C-S-right>, then flyspell-word runs once, which is also way too often, slowing me down. Any suggestion? – feklee Jul 17 '16 at 6:47
  • 1
    You may wish to consider temporarily adding the following to flyspell-word to make testing a little easier: (message "flyspell-previous-command: %s | this-command: %s" flyspell-previous-command this-command). That will help you identify the commands being called interactively, instead of using C-h v last-command or hitting C-h k C-S-right. If you want to delay checking the word, then add the interactive function to the list of delayed-commands. If you want to check just the first time, but not successive calls, then add the interactive function to the list of deplacement-commands. – lawlist Jul 17 '16 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.