Subject: bug#35397: flyspell-mode affects delete-selection-mode

From: Евгений Курневский<[email-masked]>
Date: Sun, 30 Jun 2019 17:53:56 +0000

Yes, you are right, the problem is with highlighting. But there is another
undesired consequence - flyspell mode prevents `company` popup in this
case, it appears only after second character is typed. I investigated it a
bit and it seems it's caused by `sit-for` used inside
`flyspell-check-word-p`. So I came up with a workaround that solves both
these issues:

(advice-add 'flyspell-check-word-p :around (lambda (orig-fun &rest args)
                                             (if (eq this-command
'self-insert-command)
                                               (memq
(get-char-code-property (char-before) 'general-category) '(Zs Zl Zp))
                                               (apply orig-fun args))))

This makes flyspell return immediately when `self-insert-command` was used.