--- flyspell.el.orig 2014-02-23 02:17:03.680107519 +0100 +++ flyspell.el 2014-02-23 02:50:50.634625248 +0100 @@ -1050,8 +1050,19 @@ (save-excursion (let ((r '()) (inhibit-point-motion-hooks t) + (flyspell-not-casechars (flyspell-get-not-casechars)) p) - (while (and (not r) (setq p (search-backward word bound t))) + (while + (and (not r) + (setq p + (re-search-backward + (concat + "\\(" flyspell-not-casechars "\\|\\b\\)" + "\\(" word "\\)" + flyspell-not-casechars + ) + bound t))) + (goto-char (match-beginning 2)) (let ((lw (flyspell-get-word))) (if (and (consp lw) (if ignore-case @@ -1068,8 +1079,19 @@ (save-excursion (let ((r '()) (inhibit-point-motion-hooks t) + (flyspell-not-casechars (flyspell-get-not-casechars)) p) - (while (and (not r) (setq p (search-forward word bound t))) + (while + (and (not r) + (setq p + (re-search-forward + (concat + flyspell-not-casechars + "\\(" word "\\)" + "\\(" flyspell-not-casechars "\\|\\b\\)" + ) + bound t))) + (goto-char (match-beginning 1)) (let ((lw (flyspell-get-word))) (if (and (consp lw) (string-equal (car lw) word)) (setq r p)