textmodes/flyspell.el: Don't check pre-word if buffer was switched.
authorAgustín Martín <agustin.martin@hispalinux.es>
Wed, 17 Apr 2013 18:03:46 +0000 (20:03 +0200)
committerAgustín Martín <agustin.martin@hispalinux.es>
Wed, 17 Apr 2013 18:03:46 +0000 (20:03 +0200)
commitffe54a139dddefdfd3f0837281ebb62d7cc0a912
treef17d3982c373193eb45cecf7f0e5cebe55834dad
parentec7e39f24707268201a444fc4bbc42b2dffae6c5
textmodes/flyspell.el: Don't check pre-word if buffer was switched.

If command changed the buffer, the decision may be made based on the
current buffer even though it should based on the previous one.  This
may lead to false positives and more importantly to errors since
`flyspell-pre-point' is buffer local so it may have unsanitised value
(such as nil) in previous buffer.

To be honest, I'm not sure how this can happen since
`flyspell-pre-point' is set in previous buffer, but nonetheless, I've
been encountering the error for quite some time and finally decided to
fix it.  Interestingly, line making `flyspell-pre-point'
a buffer-local variable has a very revealing "Why?? --Stef" comment.

To avoid the problem, change flyspell-check-pre-word-p so that it does
not allow checking of pre-word if command changed buffer
(ie. `flyspell-pre-buffer' is not current buffer).
lisp/ChangeLog
lisp/textmodes/flyspell.el