Fixes the failure in enabling spell checking when opening a file
when using events based on the file type.

Uses a more fine-grained strategy for detecting buffer changes.