2

There are already questions on disabling flyspell (see: https://stackoverflow.com/questions/3423638)

However I would like to toggle flyspell at runtime.

An annoyance I've found is the red-underline persists, even once flyspell has been disabled.

Closing and opening the file refreshes, but that's impractical.

eg:

(turn-off-flyspell)
(flyspell-mode 0)

;; force refresh of highlighting (doesn't work)
(font-lock-fontify-buffer)

Is there a way to clear underlined text?

1 Answer 1

2

flyspell-delete-all-overlays is a built-in non-interactive function, which is called by turn-off-flyspell.

2
  • Thanks for the hint, it works but for some reason I need to call it directly. (flyspell-mode 0) (turn-off-flyspell) fails. Adding (flyspell-delete-all-overlays) afterwards works.
    – ideasman42
    Mar 14, 2018 at 1:54
  • It sounds like something is interfering with turning off flyspell-mode in your setup, e.g., buffer narrowed, indirect-buffer is involved in the equation, ... You might want to spend some time working with a minimal example and then gradually work-up to your full-setup until you track down what is causing the interference ....
    – lawlist
    Mar 14, 2018 at 2:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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