I use flyspell-prog-mode, and quite often I comment a region, the source code was checked, and the font lock of dirty words will left after I uncomment the source code.

enter image description here enter image description here enter image description here How can I fixes this? Thanks in advance!

  • Do you basically just want to remove flyspell overlays from the beginning of the region with start at the beginning of require_columns and end at the last closing }? So we just take uncomment-region and use the same start/end to remove flyspell overlays within that region, right?
    – lawlist
    Jan 24 '17 at 5:48
  • Wouldn't it be possible to advice uncomment-region to call flyspell-region after it's done?
    – omajid
    Jan 24 '17 at 6:06
  • @omajid -- you are on the right track, but you just need flyspell-delete-region-overlays with the correct start/end. Go ahead and write it up and collect your 100 points. :) My understanding is that the original poster wants zero flyspell overlays when the uncommenting process is concluded.
    – lawlist
    Jan 24 '17 at 6:09
  • Thanks for your suggestion, I've also found the function flyspell-delete-region-overlays but tracking disabling flyspell-mode which deletes the overlays automatically. By advising uncomment-region I solved this but I'm glad to accept the answer from anyone other than me:) Jan 24 '17 at 6:57
  • I'm just speculating here, but maybe you can inject something into the font-lock system that would clear flychecks overlays whenever part of a buffer is rehighlighted. Technically, you could add a font-lock keyword that would perform the clear as a side effect, while always failing to match anything (i.e. it should return nil). (Should anybody want to try it out and if it works, feel free to post it as an answer.) Jan 24 '17 at 8:53

Your Answer

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

Browse other questions tagged or ask your own question.